AUTOLISP LANGUAGE EXTENSON

STRING FUNCTIONS

STRING-ADD-PREFIX STRING-ADD-SUFFIX

STRING-ADD-PREFIX string prefix
Return a string consists of prefix and given string

Command: (string-add-prefix "abc.com" "www.")
"www.abc.com"

STRING-ADD-SUFFIX string suffix
Return string consists of and given string and suffix

Command: (string-add-suffix "www.abc" ".com")
"www.abc.com"

STRING-BOOL string

return T if string "TRUE" or "YES"
return nil if string "FALSE" or "NO"

STRING-CAMELCASE string

STRING-CAPITALIZE string
Return string converted to lowercase with first uppercase character from given string

Command: (string-capitalize "aaaa Abbb Ddddd")
"Aaaa abbb ddddd"

STRING-CHAR string index
Return character at position index of the given string

Command: (string-char "abcd" 0)
nil
Command: (string-char "abcd" 1)
"a"
Command: (string-char "abcd" 5)
""

STRING-CONTAINS string string2
Return index at position where string2 is found in given string

Command: (string-contains "abcabc" "ca")
2

STRING-COUNT string string2
Return a number of occurences of string2 in given string

Command: (abracadabra:string:count "abcabc" "abc")
2
Command: (abracadabra:string:count "abcabc" "abca")
1
Command: (abracadabra:string:count "abcabc" "abcd")
0

STRING-EXTRACT string pattern

extract string (word) including pattern

STRING-FIRST-CHAR string
Return first character of given string

Command: (string-first-char "abcd")
"a"

STRING-DETECT string pattern

return T if pattern detected in string otherwise nill

STRING-DOWNCASE string
Return string converted to lowercase from given string

Command: (string-downcase "AAAA")
"aaaa"
Command: (string-downcase "AaaA BbbB")
"aaaa bbbb"

STRING-END-WITH-P string string2
Return T if given string ends with string2

Command: (string-ends-with-p "abcabc" "bc")
T
Command: (string-ends-with-p "abcabc" "ba")
nil

STRING-EMPTY-P string

STRING-FORMAT string list

STRING-FORMAT-AS-NUMBER integer

resuly 12345 shall return "12,345"

STRING-HASHTAG string
Return a string converted to hashtag from a given string

Command: (string-hashtag "abcd")
"#abcd"
Command: (string-hashtag " abcd ")
"#abcd"

string-hashtag combines words in single hashtag

Command: (string-hashtag " ab c d ")
"#abcd"

STRING-HASHTAG2 string
Return a string of hashtags converted from each word in given string

Command: (string-hashtag2 "abcd")
"#abcd"
Command: (string-hashtag2 "ab c d")
"#ab #c #d"

STRING-HASHTAG3 list-of-strings
Return a string consists of hashtags converted from given list of strings

Command: (string-hashtag2 (list "ab" "cd"))
"#ab #cd"

STRING-INSERT string string2 index
Return a string consists of given string including string2 inserted at position index

Command: (string-insert "abcabc" "||" 3)
"abc||abc"

STRING-JOIN delimiter list-of-strings
Return string by joining list-of-strings by given delimiter

Command: (string-join " " '("a" "b" "c"))
"a b c"
Command: (string-join ":" (list "a" "b" "c" "d"))
"a:b:c:d"

STRING-LENGTH string
Return number of characters of given string , otherwise nil

Command: (abracadabra:string:length "abcd")
4
Command: (abracadabra:string:length 'e)
nil

STRING->LIST-CHARS string
Return list of characters of given string , otherwise nil

Command: (string->list-chars "abcdefg")
("a" "b" "c" "d" "e" "f" "g")

STRING->LIST-CHARS-CODE string
Return list of character codes of given string , otherwise nil

Command: (string->list-chars-code "abcdefg")
(97 98 99 100 101 102 103)
Command: (string->list-chars-code "")
nil

STRING->LIST-NEWLINE string

split to list using new line character "\n"

STRING->LIST-PATTERN string pattern
Return a list consists of items split by string pattern from giving string

Command: (abracadabra:string->list-pattern "abc. abc." ".")
("abc" " abc" "")

STRING->LIST-WHITESPACE string
Return a list consists of items split by whitespace from giving string

Command: (abracadabra:string->list-whitespace "abc abc")
("abc" "abc")
Command: (abracadabra:string->list-whitespace " abc abc ")
("" "abc" "abc" "")

STRINGP item
Return T if item is string, otherwise nil

Command: (stringp "abcd")
T

STRING-NUMERIC-P string

return T if string contains only numbers

STRING-PAD string length
Return a string consists of spaces on both sides left and right and given string

for a specific length

Command: (abracadabra:string:pad "abcd" 6)
" abcd "

STRING-PAD-LEFT string length
Return a string consists of spaces on the left and given string

for a specific length

Command: (string-pad-left "abcd" 5)
" abcd"

STRING-PAD-RIGHT string length
Return a string consists of given string and spaces on the right
for a specific length

Command: (string-pad-right "abcd" 5)
"abcd "

STRING-REMOVE string string2
Return a string without first occurance of string2 in given string

Command: (string-remove "abc abc" "abc")
" abc"
Command: (string-remove "abcabc" "ca")
"abbc"

STRING-REMOVE-ALL string string2
Return a string without all occurances of string2 in given string

Command: (string-remove-all "abc abc" "abc")
" "
Command: (string-remove-all "abc abc" "c")
"ab ab"

STRING-REMOVE-CHARS string index number-of-characters
Return a string without number-of-characters removed at position index from given string

Command: (string-remove-chars "abcdef" 1 3)
"def"
Command: (string-remove-chars "abcdef" 3 2)
"abef"

STRING-REMOVE-END string string2
Return a string with removed string2 from the end of given string, otherwise nil

Command: (string-remove-end "abcdef" "ef")
"abcd"
Command: (string-remove-end "abcdef" "efg")
nil

STRING-REMOVE-LINE string line

STRING-REMOVE-NEWLINE string line

STRING-REMOVE-SPACE string

STRING-REMOVE-START string string2
Return a string with removed string2 from the beginning of given string

Command: (string-remove-start "abcdef" "abc")
"def"
Command: (string-remove-start "abcdef" "zabc")
nil

STRING-REPEAT string number-of-copies
Return string with number of copies of given string , otherwise nil

Command: (string-repeat "a " 5)
"a a a a a "
Command: (string-repeat "-" 40)
"----------------------------------------"
Command: (string-repeat " *** " 0)
nil

STRING-REVERSE string

STRING-START-WITH-P string string2
Return T if given string starts with string2

Command: (string-starts-with-p "abcabc" "ab")
T
Command: (string-starts-with-p "abcabc" "aa")
nil

STRING-SUBSTRING string

STRING-TAKE string index number-of-characters
Return string consists of number-of-characters of given string

starting at position index

Command: (string-take "abcd" 1 2)
"ab"
Command: (string-take "abcd" 2 2)
"bc"
Command: (string-take "abcd" 1 6)
"abcd"

STRING-TAKE-LEFT string number-of-characters
Return string consists of number-of-characters of given string

starting from left side

Command: (string-take-left "abcd" 2)
"ab"
Command: (string-take-left "abcd" 5)
"abcd"

STRING-TAKE-RIGHT string number-of-characters
Return string consists of number-of-characters of given string

starting from right side

Command: (string-take-right "abcd" 2)
"cd"
Command: (string-take-right "abcd" 5)
nil

STRING-UPCASE string
Return string converted to uppercase from given string

Command: (string-upcase "aaaa")
"AAAA"
Command: (string-upcase "AaaA BbbB")
"AAAA BBBB"