Vely logo Empower C
install  tutorials  examples
documentation  license  about

12.1.0 released on Sep 19, 2022

trim-string



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 point 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. Icons copyright PaweĊ‚ Kuna licensed under MIT. This web page is licensed under CC-BY-SA-4.0.