Single international character problem



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

    On 05/04/2006 at 07:10, xxxxxxxx wrote:

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

    ---------
    Imagine I have the following string:

    var st="áéíóú";

    if I perform a println(st); I get:

    áéíóú

    Correct!! Now, if I do the following:

    println(st[2]);

    I get:

    237

    Ok, I have to convert it to a character, so I do the following:

    println(tostring(st[2],"c");

    but I get:

    Ì

    instead of "é". "Ì" was not even in the original string!!

    How can I get individual characters from inside a string, correctly evaluated? Thank you very much in advance for any solution.

    Rui Batista



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

    On 06/04/2006 at 12:53, xxxxxxxx wrote:

    Do:

        
        
        var st="áéíóú";  
        var i = 2-1;  
        println(strmid(st,i,1));
    

    Note that strings are of course 0-indexed as well as arrays in C.O.F.F.E.E.



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

    On 06/04/2006 at 16:43, xxxxxxxx wrote:

    Thank you, Mikael.
    The solution I found is not far from it. This is what I did:

      
    add_char(line,char)  
    {  
    if(char<127) line=stradd(line,tostring(char,"c"));  
    else  
    line=stradd(line,strmid("?áéíóúàèìòùÁÉÍÓÚÀÈÌÒÙãÃâÂêÊîÎôÔûÛçÇñÑäÄëËïÏöÖüÜ",strchr(" áéíóúàèìòùÁÉÍÓÚÀÈÌÒÙãÃâÂêÊîÎôÔûÛçÇñÑäÄëËïÏöÖüÜ",char),1));  
    }
    

    While calling this routine with add_char(&line;,char);

    Rui Batista


Log in to reply