Vely logo install
examples
documentation

Vely 15.2.0 released on Jan 18, 2023
Articles updated Jan 17, 2023

trim-string


Issues with this documentation page? Report here.

Purpose:


Trim a string.

Syntax:



trim-string <string> [ length [ define ] <new length> ] [ result [ define ] <result> ]


Description:


trim-string trims <string>, both on left and right. You can optionally get the length of the changed string by using "length" clause, in integer variable <new length>, which can be created with optional "define".

Without "result" clause, trimming is in place, i.e. if necessary the bytes within <string> are shifted to the left, and the result is <string>. With "result" clause,  <result> points to trimmed value within <string>, i.e. there is no movement of memory - this is a faster trim, but the pointer to the result is no longer <string>.

Examples:


The variable "str" will be "some string" and "new_len" will be 11:

char str[] = "  some string  ";
trim-string str length define new_len

With "result" clause, the variable "str" will be "some string" and "new_len" will be 11, and "res" will point to (str+2):

char str[] = "  some string  ";
trim-string str length define new_len result define res


See also:


Strings ( copy-string   count-substring   lower-string   split-string   trim-string   upper-string   write-string  )  SEE ALL (documentation)



Copyright (c) 2022 DaSoftver LLC. Vely is a trademark of Dasoftver LLC. The software and information herein are provided "AS IS" and without any warranties or guarantees of any kind. Vely elephant logo (c) 2022 DaSoftver LLC. This web page is licensed under CC-BY-SA-4.0.