Debug "* Trim, LTrim and RTrim"ĭebug #DQUOTE$ + String3 + #DQUOTE$ LSet sets a string to be a specific length from the left hand end, padding with spaces, or other specified character, as necessary. Similarly, LTrim acts on the left hand end (start) of a string and RTrim the right hand end. Trim removes white space characters from the start and end of a given string. String2 = ReplaceString(String1, " ", "\") StringField will work with space as a delimiter too but hopefully this example makes the functions behaviour more apparent. Useful for converting strings to lists for example. StringField can be used to obtain an indexed substring from a target string. Debug StringByteLength(String1, #PB_Unicode) Debug StringByteLength(String1, #PB_Ascii) StringByteLength returns the length of a string in bytes in the specified format, or the current default if one is not specified (excluding the terminating null). String2 = ReplaceString(String1, "lazy", "sleeping") Shows The quick brown fox jumps over the sleeping dog. ReplaceString can be used to change the occurrence of a substring within another string. String2 = RemoveString(String1, " brown") Shows The quick fox jumps over the lazy dog. RemoveString can be used to remove one string from within another. FindString can be used to find the location of one string within another. However the LCase (and UCase) functions can be used to switch a string to all lower (or upper) case Shows 2 Debug "* CountString and LCase" CountString returns the number of instances of the second string in the first string, it is case sensitive. Shows "The brown dog." Debug "* Left, Mid and Right" Space returns the specified number of space characters as a string. Right returns a number of characters from the right hand end of a string. Mid returns a number of characters from the given start location in the middle of a string. Left returns a number of characters from the left hand end of a string. String1 = "The quick brown fox jumps over the lazy dog." Library - their purpose and their correct use. The following example shows step by step the different commands of the string
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |