• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cutting strings from right to left
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cutting strings from right to left


  • Subject: Re: Cutting strings from right to left
  • From: "a.d. jensen" <email@hidden>
  • Date: Fri, 9 Dec 2005 13:32:07 -0600

Hows about:

if (strlen(strVal)) > 4)
strVal[strlen(strVal) - 4] = 0;

(assumes c string -- Pascal string: strVal[0] = strVal[0] - 4;)

All that assumes that you truly always want to cut four digits off of the end :-)


dale

--
email@hidden http://adjensen.aatrix.com

Only a fool turns away from an angel,
Vision in white steps through the door,
Holds out her hand, I say 'No I'm not ready'
I open my eyes and let the dream fade away.
-- echolyn, "on any given nite"


On Dec 9, 2005, at 1:17 PM, Sanri Parov wrote:

Hi everybody,

I've got the goal to transform these strings

-8.230000
120.000000

into

-8.23
120.00

by mean of cutting 4 decimal zeroes.
Is there a way to do this easily ?
Many thanks !!


--
Sanri Parov from iBook




_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
References: 
 >Cutting strings from right to left (From: Sanri Parov <email@hidden>)

  • Prev by Date: Re: threads vs run-loops for keeping your GUI responsive
  • Next by Date: What is the best/simplest/proper way to make right mouse click "do" left mouse click as well in NSTableView
  • Previous by thread: Re: Cutting strings from right to left
  • Next by thread: What is the best/simplest/proper way to make right mouse click "do" left mouse click as well in NSTableView
  • Index(es):
    • Date
    • Thread