Substring Coma Splicing

Ok, this is such a dumb question,but can you seperate a full string like

abc,def,ghi 

into substrings :
abc
def
ghi
by separating them by the comas. not by letter number

Also, if we use letter numbers, so like in string asdfg
if we go from letter 2 to letter 4, does letter 2 actually count in the substring?

1 Like

umm i think you can but idk

Yes, you can sperate strings into substrings.

1 Like

I know, I wanna know if you can seperate them by using the comas, not by letter numbers

1 Like

What are you using this for?

1 Like

probably you can but u should try it

Oh, umm, nothing…

this is just a convenience that I really need.
If there is no way, then uh, il do it manuellly.

when you reply to a thing, you cant just say. “yes, possible.”
You have to list WHY its possible. If you don’t have a why,than how do you know that it is possible.

The substring() method extracts characters, between two indices (positions), from a string, and returns the substring .

Looked this up. I think commas do too though

is this a block in GKC?

No but you could probably look this up and find out how to make it

oh yes right.
“You need a solution? look it up!”
cmon, do you think I haven’t tried that?
I just need a script that can do this for me.
I am positively stumped.

Can someone acually give a semi decent answer?

All the answers so far have been : Yes possible, dunno how,

Well, if you dunno how, then how do you know that its possible?

EXACTLY!
oh also hi astra/Sammy.

or :
look it up.

anyways, sorry for venting. this guy just texted me (on discord) something rude.

anyone?

I can help you. This isn’t that hard, I’ve done the same thing for somebody else before. Let me go into Gimkit and make the blocks for you.

1 Like

Quick question: how do you want it to return exactly? Do you just want the commas removed, or something in their place, like a space.
Example: removing commas
abc, def, ghi
to
abcdefghi
or
abc def ghi


Also, are there spaces in between the comma and next letter/number?

THANKS!
this has been a big problem for me, ecspecailly dealing with large strings

comas removed, each in differnent properties.
so abc,def,ghi
turns into
Property 1: abc
Property 2 : def
Property 3 : ghi

1 Like

Ok! Coming right up!

1 Like

Here we go. Notice: this might look like a lot, but it makes sense and really isn’t that much.




Here’s an explanation:

First, we have property “stringoftext”. This property holds the original strand of text, and is edited during the splicing period to only contain the part we haven’t worked on yet. Next, there’s “substringproperty_”. These are the properties that hold the codons that we spliced (i.e. abc or def). You will need more or less depending on how long the strings are (you won’t have to change any code based on that). Last, we see the “substring#” property. It just adds one after each splice so that we are updating the next substring_ next time, not overlaying an old one.

Now to look at the process. The first part just tells if we have more than 3 letters left. Let’s first assume that’s true. Starting out, the substring# should have a default of one, so we are setting the text for substringproperty1. We are going to get the first ones until the comma, so starting from the first letter until the letter that is before the comma (comma # - 1). Faboulous! Then in the second part, we just set the new text. This is done by deleting the text all the way including the comma, but not after that. This will make sure we can start at the first letter next time. We then adjust our substring# and broadcast to recur.

Now let’s assume we’ve done a lot, and we’re down to only two letters left. This will update the final substringproperty_ with all that is remaining. We then reset all of our properties that need to and broadcast that we’re done!


I didn’t test this out but it should work (lol I even layed out why it should above). If you have any questions or it isn’t working, just drop a reply and I’ll help you when I’m available!

3 Likes