Still have questions? Join our Discord server and get real time help.
0

# How to get the first letter?

Edited 2 years ago

Is there a way you can get the first letter in a string or the second or whatever number. Through how stuff normally is on roblox studio I originally though it would be like this:

Str = "Stri"
print(Str[3])


5
RubenKan 3473
2 years ago

Strings have something called substring, wich is accesed by doing string:sub(StringValue,start,end)

if we do string.sub("Hello, world!",1,1) we would get H as return.

if we do string.sub("Hello, world!",2,4) we would get ell as return.

you can also do

("Hello"):sub(start,end) or MyStringValue:sub(start,end)

Suggest also reading this short wiki article

0
thanks you are a legend shabbs15 67 — 2y
0
same incapaxx 3361 — 3mo
-3
Str = "Stri"