Results 1 to 6 of 6

Thread: Size of CL_String

  1. #1

    Default Size of CL_String

    hello

    i have a problem with a CL_String.

    I try to find out the length but all variables do not work wenn i use the length it doe not work, when i use the size also nothing

    how can i figure out how long my cl_string is ?

    i hope you understand..

    for example you will substr and the half of the word then you need the length of the string :

    CL_String text = "Peter";
    int length = text.length(); //does not work
    CL_String sub_text = text.substr(0,length/2);

  2. #2
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    I have not tested it

    But ensure that you have called CL_SetupCore and that it does not go out scope

  3. #3

    Default

    Yes im sure

  4. #4
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    Please provide a minimal, but complete example that demonstrates the defect.

  5. #5

    Default

    Ok now i've found a way..

    Interessting is that you can not divide the size or i did it wrong, cause everytime i try to divide the size it has not the result that i want but i solved my problem and so it can closed

  6. #6
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    For reference:

    CL_String text = "Peter";
    int length = text.length(); //does not work
    CL_String sub_text = text.substr(0,length/2);

    sub_text should equal "Pe"

Similar Threads

  1. changing the size of CL_Font_Sprite
    By xrubio in forum Official ClanLib SDK Forums
    Replies: 8
    Last Post: 07-27-2009, 09:49 AM
  2. default window size...
    By harrio in forum Novashell Game Creation System
    Replies: 6
    Last Post: 02-18-2008, 05:38 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •