Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How would I store a specific part of a string after finding it?

For example, if the string was "Hello World", would I be able to search the string for the letter "e" and then store that "e" as a string on its own?

7 comments

0

string.sub

0

string.find might be of help to you.

0

actually string.match but that can work

0

string.find would get the location

0

yeah

0

I know, but I don't want it to return a location, I want it to return the single letter it found. I'll try match and sub, though not too familiar with them now.

0

string.match("Hello World", "e") will give you the location, then you can use the location with string.sub to get the lone letter as a value. After that, you can just store the lone letter into a variable.

1 answer

let's say the string is "hello world" to store it, you can use this method

local StoreString = Instance.new("String Value")
StoreString.Name = "Store String" -- just an example
StoreString.Parent = workspace -- just an example
StoreString.Value = "Hello World"

2 comments

0

not what op wanted + you know how to use code blocks so use them

0

I just put them in blocks

This discussion is preserved as it was. New answers, comments, and votes are closed.