Skip to content

StringTake

StringTake("string", n)

gives the first n characters in string.

StringTake("string", -n)

gives the last n characters in string.

StringTake("string", {n})

gives the nth character in string.

StringTake("string", {m, n})

gives characters m through n in string.

StringTake("string", {m, n, s})

gives characters m through n in steps of s.

Examples

>> StringTake("abcde", 2)
ab
>> StringTake("abcde", 0)
>> StringTake("abcde", -2)
de
>> StringTake("abcde", {2})
b
>> StringTake("abcd", {2,3}]
bc
>> StringTake("abcdefgh", {1, 5, 2})
ace
>> StringTake("abcdef", All)
abcdef

StringCases, StringContainsQ, StringCount, StringExpression, StringFreeQ, StringInsert, StringJoin, StringLength, StringMatchQ, StringPart, StringPosition, StringQ, StringReplace, StringRiffle, StringSplit, StringToByteArray, StringTrim

Implementation status

  • ✅ - full supported

Github