Results 1 to 8 of 8

Thread: Problem parsing int to string

  1. #1
    Join Date
    Aug 2010
    Posts
    39

    Problem parsing int to string

    Hello,
    I just have a little problem solving and design is currently very difficult. Roughly speaking, I'd just pass an int value into a string value, with the int value which can easily exceed 10 000 must be why I do this with char

    Code:
    ... Constant int nm, int fld [] = new int fld box [nm]; for (int s = 0; s' nm, s + +) (fld [s] = s;)
    target while it's name designations for the 10,000 objects to generate. the object 15 should also be on field.

    Code:
    / / Pseudo code 15 = string field [15];
    Is probably the fix in java gibts there I think just functional ToString. But as I said, it is important that I then access value than any in a string is returned as a name. Do you have a solution for this? Thank you.

  2. #2
    Join Date
    Apr 2008
    Posts
    240

    Re: Problem parsing int to string

    Did I understand correctly that you want to convert an integer to a string? Are, for example for sprintf (). This feature works written in principle as printf (), except that the result will not be displayed on the screen but in the given string is, sprintf (buffer, "% d", MyInt) writes "MyInt" in human readable form into "buffer".

  3. #3
    Join Date
    Aug 2010
    Posts
    39

    Re: Problem parsing int to string

    That I have also tried. just how do I access then to element 2500? I would have to access the 2500ste element can.
    Code:
    a = string [2500]
    And a would give me the string "2500". I have integers sequence that is then 50 000 elements and each will get its own name, in ascending from. What do you think? Please help me with this.

  4. #4
    Join Date
    May 2008
    Posts
    248

    Re: Problem parsing int to string

    You are using an Array of char * button to save the string.

    Code:
    int x;
    
    for (x = 0; x <temp; x + +) (
    sprintf (buffer [x], "% d", myValue [x]);
    )
    Just try the above example.

  5. #5
    Join Date
    Mar 2010
    Posts
    338

    Re: Problem parsing int to string

    This is the code you are looking for

    Code:
    # Include <iostream> 
    # Include <cstdio> 
    # Include <cstring> 
    
    const int mx = 100; 
    
    int main() 
    ( 
            int x=0; 
            tst char[mx]; 
            char fld[mx] [mx]; 
    
    
            for (x =0; x<100; x+ +) 
            ( 
                    snprintf(tst, mx, "Object% x", x); 
                    strcpy(feld[x], tst); 
            ) 
    
            court << Field[45] << endl; 
    )

  6. #6
    Join Date
    Aug 2010
    Posts
    40

    Re: Problem parsing int to string

    Yes again about the fugitive task setting. So I just want a intWert read from a field of integers and then convert it to a string so I can then use it as a string. in the string I want you to any index can jump and get down with the there are.

  7. #7
    Join Date
    Aug 2010
    Posts
    41

    Re: Problem parsing int to string

    I do not know if I have understood your problem correctly, but perhaps even helps my code. Furthermore, I'm assuming that you used C + +. Then I would recommend that guy std:: string, std:: vector as these things a beginner can make your life easier and also have enormously useful for your problem are available.

  8. #8
    Join Date
    Aug 2010
    Posts
    37

    Re: Problem parsing int to string

    I have a date as a String that I converted to date thanks SimpleDateFormat.parse (String)
    The date format is "HHmmss.SSS". Trouble is, when the time is less than 10 hours, the date has not 0 before the first digit format becomes "Hmmss.SSS". If I did parse (String) with the format "HHmmss.SSS", it works for the first but not the second. If I did with the format "Hmmss.SSS", is the reverse.

Similar Threads

  1. Problem to convert binary to string
    By steg in forum Software Development
    Replies: 1
    Last Post: 08-04-2011, 01:21 AM
  2. Problem with a null string in java
    By Rily in forum Software Development
    Replies: 4
    Last Post: 12-08-2010, 10:23 AM
  3. Problem in retrieving string with Regex
    By Aaliya Seth in forum Software Development
    Replies: 5
    Last Post: 11-02-2010, 05:53 AM
  4. Problem with Regex in returning string
    By Ash maker in forum Software Development
    Replies: 5
    Last Post: 05-02-2010, 03:37 AM
  5. Problem in creating array from string values
    By Cedric in forum Software Development
    Replies: 4
    Last Post: 19-01-2010, 05:48 PM

Tags for this Thread

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
  •  
Page generated in 1,716,340,506.37701 seconds with 17 queries