Link Search Menu Expand Document

Strings

Functions


charcode

int charcode(string text)

Returns ASCII code for the first character in given string.


get_string_pointer

sfall.h

int get_string_pointer(string text)

Returns a pointer to a string variable or to a text.


string_format

sfall.h

string string_format(string format, any val1, any val2, ...)

Formats given value using standard syntax of C printf function (google “printf” for format details). However it is limited to formatting up to 4 values.

  • formatting is only supported for %s and %d, and the format string is limited to 1024 characters

string_split

array string_split(string, split)

Takes a string and a seperator, searches the string for all instances of the seperator, and returns a temp array filled with the pieces of the string split at each instance. If you give an empty string as the seperator, the string is split into individual characters. You can use this to search for a substring in a string like this: strlen(get_array(string_split(haystack, needle), 0))


string_to_case

string sfall_func2("string_to_case", string text, int toCase)

Converts all letters in the given string to the specified case.

toCase: 0 - lowercase, 1 - uppercase

NOTE: this function works only for English letters of A-Z/a-z.


strlen

int strlen(string text)

Returns string length.


substr

string substr(string, start, length)

Cuts a substring from a string starting at “start” up to “length” characters. The first character position is 0 (zero).

  • If start is negative - it indicates starting position from the end of the string (for example substr("test", -2, 2) will return last 2 charactes: “st”).
  • If length is negative - it means so many characters will be omitted from the end of string (example: substr("test", 0, -2) will return string without last 2 characters: “te”).
  • If length is zero - it will return a string from the starting position to the end of the string New behavior for sfall 4.2.2/3.8.22