Left, Mid & Right functions for Cerberus X

AutmnLeaf

Member
Joined
Feb 19, 2018
When I rewrote my Easy Math Challenge in Cerberus X, I also implemented these easy String functions. There're easy to implement, but if you haven't implemented them, you might think in your project alternative ways to implement something, which in some cases might be more complicated. Any way here they are:

Left, Mid & Right functions for Cerberus X:
    Method mid:String(str:String, startPos:Int, howMany:Int)
  
        Return str[(startPos)..(startPos+howMany)]
    End

    Method left:String(str:String, howMany:Int)
  
        Return str[0..howMany]
    End
  
    Method right:String(str:String, howMany:Int) 
        Return str[(str.Length()-howMany)..(str.Length())]
    End
Example usage directly form Easy Math Challenge:
  • mid(scrollText,charCounter,1)
  • left(actualVPuzzle,1)
You'll get the idea. :)
 
Last edited:
Top Bottom