Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Individual String Character Access

    Scheduled Pinned Locked Moved SDK Help
    2 Posts 0 Posters 210 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 02/02/2011 at 15:30, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   12 
      Platform:      Mac OSX  ; 
      Language(s) :   C.O.F.F.E.E  ;   XPRESSO  ;

      ---------
      Hi guys!

      So I'm not a coder, really at all, but I'm trying to learn some basics. Right now I'm working on a COFFEE node in xpresso, and I'm attempting to get it to read a user generated string variable, then output an individual character, so if the use string was "Hello", I'd want to run it through the COFFEE node and return "H".

      http://s150.photobucket.com/albums/s94/EitriTheBerserk/?action=view&current=Picture142.png

      This is where I'm at. I've been looking at the documentation for COFFEE and it said to access individual characters of a string, I can use [0] to access the array index number. When I do it in this case, it doesn't return an H, but "72" into the console. Is there something I'm missing, or is this typical? I tested it with numbers 0-4 in the brackets, each one returned a different value, save for 2 and 3, which both are L's. If I don't try to access a specific character from the string, it passes right through the node as expected, but individual characters are throwing me off.

      Thanks in advance!

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 03/02/2011 at 03:24, xxxxxxxx wrote:

        The println() function is printing the ASCII value of the character. Uppercase H = ASCII 72, so that's what you get.

        To print the actual character, do this:
        println(tostring(Input1[0], "c"));

        1 Reply Last reply Reply Quote 0
        • First post
          Last post