• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Lesson 15

Status
Not open for further replies.

ABM

ABM

Level 7
Joined
Jul 13, 2005
Messages
279
[Jass=]/*
* Declare and retrieve and display the following out of the strings
*
* "hello world" -> "world"
* "this is something" -> "is"
* "12345" -> 12345 -> (3 + 6) -> 12945 -> "12945"
*
* S2I
* I2S
*
*/

//! runtextmacro Variables()
string a
string b
string c
string array d
//! runtextmacro Actions()
set a = "hello world"
set b = "this is something"
set c = "12345"
call Print(SubString(a, 6, 11))
call Print(SubString(b, 5, 7))
call Print(SubString(c, 0, 5))
set d[1] = SubString(c, 0, 1)
set d[2] = SubString(c, 1, 2)
set d[3] = SubString(c, 2, 3)
set d[4] = SubString(c, 3, 4)
set d[5] = SubString(c, 4, 5)
set d[3] = I2S(S2I(d[3]) + 6)
call Print(d[1] + d[2] + d[3] + d[4] + d[5] )
call Print(SubString(c, 0, 2) + I2S(S2I(SubString(c, 2, 3)) + 6) + SubString(c, 3, 5) )
//! runtextmacro End_Code()[/code]
 
Status
Not open for further replies.
Top