This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.
  • Index
  •  » Suggestions
  •  » LeftString, RightString, and SubString functions needed

#1 2012-07-24 15:47:04

BoltBait
Scratcher
Registered: 2009-03-09
Posts: 1000+

LeftString, RightString, and SubString functions needed

I'm glad version 1.4 added a few string manipulation functions.

However, I'm going crazy without the following (should be green):

<first (10) letters of [string]>
<last (10) letters of [string]>
<middle (10) letters of [string] starting at letter (3)>

Last edited by BoltBait (2012-07-24 15:50:11)


Animated sigs must be banned!
http://boltbait.com/j.pnghttp://boltbait.com/s.pnghttp://boltbait.com/d.pnghttp://boltbait.com/a.pnghttp://boltbait.com/p.png

Offline

 

#2 2012-07-24 15:56:56

Wes64
Scratcher
Registered: 2011-08-19
Posts: 1000+

Re: LeftString, RightString, and SubString functions needed

How about just

<letters (1) through (4) of [string]>
I support though.

Last edited by Wes64 (2012-07-24 15:57:09)


Experienced 2.0 Tester: Ask me questions!
Using Firefox 13.0, Flash plugin version 11.4.402.287, and Windows XP Professional.

Offline

 

#3 2012-07-24 16:10:04

BoltBait
Scratcher
Registered: 2009-03-09
Posts: 1000+

Re: LeftString, RightString, and SubString functions needed

I would be happy with that!


Animated sigs must be banned!
http://boltbait.com/j.pnghttp://boltbait.com/s.pnghttp://boltbait.com/d.pnghttp://boltbait.com/a.pnghttp://boltbait.com/p.png

Offline

 

#4 2012-07-24 16:17:42

jvvg
Scratcher
Registered: 2008-03-26
Posts: 1000+

Re: LeftString, RightString, and SubString functions needed

BoltBait wrote:

I would be happy with that!

That block exists in Insanity, so it is possible to code.


http://tiny.cc/zwgbewhttp://tiny.cc/e1gbewhttp://tiny.cc/zygbewhttp://tiny.cc/izgbew
Goodbye, Scratch 1.4  sad                                                        Hello Scratch 2.0!  smile

Offline

 

#5 2012-07-24 16:26:40

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: LeftString, RightString, and SubString functions needed

In 2.0 you will be able to build your own blocks, so it will be easy to make a substring function like those you suggest using the current letter x of y block!  smile

Offline

 

#6 2012-07-24 16:28:00

BoltBait
Scratcher
Registered: 2009-03-09
Posts: 1000+

Re: LeftString, RightString, and SubString functions needed

LS97 wrote:

In 2.0 you will be able to build your own blocks, so it will be easy to make a substring function like those you suggest using the current letter x of y block!  smile

Except that functions in 2.0 won't be able to return values.  sad


Animated sigs must be banned!
http://boltbait.com/j.pnghttp://boltbait.com/s.pnghttp://boltbait.com/d.pnghttp://boltbait.com/a.pnghttp://boltbait.com/p.png

Offline

 

#7 2012-07-24 19:23:41

TorbyFork234
Scratcher
Registered: 2012-03-01
Posts: 1000+

Re: LeftString, RightString, and SubString functions needed

BoltBait wrote:

LS97 wrote:

In 2.0 you will be able to build your own blocks, so it will be easy to make a substring function like those you suggest using the current letter x of y block!  smile

Except that functions in 2.0 won't be able to return values.  sad

They will, and even if not, you could set a variable to each block and use that as the reporter block (but it would be very impractical).

Last edited by TorbyFork234 (2012-07-24 19:24:03)

Offline

 

#8 2012-07-25 05:46:11

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: LeftString, RightString, and SubString functions needed

BoltBait wrote:

LS97 wrote:

In 2.0 you will be able to build your own blocks, so it will be easy to make a substring function like those you suggest using the current letter x of y block!  smile

Except that functions in 2.0 won't be able to return values.  sad

The simple workaround is to have a global variable called "return" (or "output", "reported", ect) and do

set [return v] to (something)
stop script
in a block definition when you want it to return something. Then do something like

get letters (1) to (4) of (string)
say (join [The first four letters of ] (join (string) (join [ are:] (return))))
when you want to get the letters.


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 
  • Index
  •  » Suggestions
  •  » LeftString, RightString, and SubString functions needed

Board footer