×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Registered User
    Join Date
    Feb 2007
    Posts
    27

    String Backwards

    Just wondering does anyone know how to write a string backwards one character at time with one second gap?...Been trying to found out but just cant find it!

    Thank you

  2. #2
    Super Contributor
    Join Date
    May 2003
    Location
    Vancouver, Canada
    Posts
    985

    Re: String Backwards

    I think you need to create a timer with one second interval. Then for each time tick, read a character of the string one by one from the end.

    Antony

  3. #3
    Super Contributor
    Join Date
    Jun 2006
    Location
    India
    Posts
    3,037

    Re: String Backwards

    for(TInt i=0; i<buffer.Length(); i++)
    {
    a= buffer[i];
    User::After(1000000);//delay of 1 second
    }
    Use [URL="http://qt.nokia.com/products/qt-quick/"]Qt-Quick[/URL] to make your application UI more attractive.

    [URL="http://store.ovi.com/content/271896"]http://store.ovi.com/content/271896[/URL] | [URL="http://store.ovi.com/content/276199"]http://store.ovi.com/content/276199[/URL] |[URL="http://store.ovi.com/content/276202"] http://store.ovi.com/content/276202[/URL] | [URL="http://store.ovi.com/content/280827"]http://store.ovi.com/content/280827[/URL]

  4. #4
    Regular Contributor
    Join Date
    Jan 2007
    Posts
    155

    Re: String Backwards

    Quote Originally Posted by kkrish
    for(TInt i=0; i<buffer.Length(); i++)
    {
    a= buffer[i];
    User::After(1000000);//delay of 1 second
    }

    And so if you use this for a string 1000 characters long your code with become totally unresponsive for 1000 seconds.

  5. #5
    Super Contributor
    Join Date
    May 2003
    Location
    Vancouver, Canada
    Posts
    985

    Re: String Backwards

    That's why I would propose to use timer. Print the string when the timer is outstanding.

    Antony

  6. #6
    Super Contributor
    Join Date
    Jun 2006
    Location
    India
    Posts
    3,037

    Re: String Backwards

    its depends on requirement, what he need? i have just given a way to do you ar4e right it take time it just on the programmer how he would like to implement.


    hope you can understand guys,

    With Best Regards,
    KKrish
    Use [URL="http://qt.nokia.com/products/qt-quick/"]Qt-Quick[/URL] to make your application UI more attractive.

    [URL="http://store.ovi.com/content/271896"]http://store.ovi.com/content/271896[/URL] | [URL="http://store.ovi.com/content/276199"]http://store.ovi.com/content/276199[/URL] |[URL="http://store.ovi.com/content/276202"] http://store.ovi.com/content/276202[/URL] | [URL="http://store.ovi.com/content/280827"]http://store.ovi.com/content/280827[/URL]

  7. #7
    Registered User
    Join Date
    Feb 2007
    Posts
    27

    Re: String Backwards

    Hello and thanks for you help!

    Basically what I need was this

    Code:
    TInt back = ichic.Length()-1;
     	for(TInt i=0; i<ichic.Length(); i++)
    	{
    	console->Printf(_L("%c"),ichic[back]);
    	User::After(1000000);//delay of 1 second
    	back--;
    Also does anyone know how to count letters?

    I have figured out how to Delete them by using this but how do I count them and prints to console?

    Code:
    TInt Letter = 0;
         while (Letter !=KErrNotFound)
         {
         	Letter = ichic.Locate('a');
         	if (Letter !=KErrNotFound )
         	{
         	ichic.Delete(Letter,1);
         	}
    Thanks
    Last edited by CND_Jackass; 2007-03-30 at 08:09.

  8. #8
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,345

    Smile Re: String Backwards

    Hi,

    Simply you can use counter.
    Code:
    TInt Letter = 0;
    TInt cnt=0;
    while (Letter !=KErrNotFound)
    {
         	Letter = ichic.Locate('a');
            if (Letter !=KErrNotFound )
            {
            cnt++;
         	ichic.Delete(Letter,1);
         	}
    }
    I hope i have understood your problem in right way, haven't i?

    Kiran.

  9. #9
    Registered User
    Join Date
    Feb 2007
    Posts
    27

    Re: String Backwards

    kiran10182

    Yup you did!....Thanks I was just coming on here to delete that message cause I figured it myself!...Thanks for your help!

  10. #10
    Super Contributor
    Join Date
    Jun 2006
    Location
    India
    Posts
    3,037

    Re: String Backwards

    you can user Mid function to get the character from the TBuf.


    hope this would be helpful to you.
    Use [URL="http://qt.nokia.com/products/qt-quick/"]Qt-Quick[/URL] to make your application UI more attractive.

    [URL="http://store.ovi.com/content/271896"]http://store.ovi.com/content/271896[/URL] | [URL="http://store.ovi.com/content/276199"]http://store.ovi.com/content/276199[/URL] |[URL="http://store.ovi.com/content/276202"] http://store.ovi.com/content/276202[/URL] | [URL="http://store.ovi.com/content/280827"]http://store.ovi.com/content/280827[/URL]

Similar Threads

  1. Replies: 4
    Last Post: 2007-02-27, 12:04
  2. How to use Gauge/Process Bar when using HttpConnection?
    By Tanya in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2006-12-28, 07:59
  3. global root overflow(please help)
    By sushant_125 in forum Mobile Java Networking & Messaging & Security
    Replies: 3
    Last Post: 2004-05-14, 08:24
  4. Personal
    By JSmith77 in forum PersonalJava
    Replies: 4
    Last Post: 2003-07-30, 12:52
  5. D211 new linux driver 1.04 not working !!
    By franz_meyer in forum Multimodecards
    Replies: 1
    Last Post: 2002-12-12, 08:31

Posting Permissions

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