PC Review


Reply
Thread Tools Rate Thread

How to covert string to a new string

 
 
Nicholas Paldino [.NET/C# MVP]
Guest
Posts: n/a
 
      12th Jul 2006
Calros,

If you want to add a number, then you can use the static ToInt32 method
on the Convert class to convert your string to an integer. Then, you can
just perform your arithmetic.

When you want to convert it back to a string, then you can call ToString
on the int variable.

As for incrementing a letter, you can create a character array and then
increment the character by one in the array.

However, you have to have logic for when you get to the letter Z.

Then you can convert the character array back to a string.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (E-Mail Removed)

"Calros Lo" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Dear all:
> I develop a programe that need when I get a string , such as "123" or
> "ABC",if I get string "123" and the system will help me to create new
> string "124" , if I get string "ABC" and the system will help me to create
> new string "ABD" , could somebody can help me how to programe it , thank
> you very much.
>
> I don't know to how to covert string as ASCII and add integer value and
> covert the integer back to string, hope can support me the code I'll very
> appricate, thanks.
>



 
Reply With Quote
 
 
 
 
Mythran
Guest
Posts: n/a
 
      12th Jul 2006

"Calros Lo" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Dear all:
> I develop a programe that need when I get a string , such as "123" or
> "ABC",if I get string "123" and the system will help me to create new
> string "124" , if I get string "ABC" and the system will help me to create
> new string "ABD" , could somebody can help me how to programe it , thank
> you very much.
>
> I don't know to how to covert string as ASCII and add integer value and
> covert the integer back to string, hope can support me the code I'll very
> appricate, thanks.
>


What happens when "ABC" eventually becomes "ABZ"? Does the previous letters
get up'ed? Such as "ACA"? If so, what happens at "ZZZ"? Does it become
"AAAA" or "ZZZA"? Need more info if we are to help

Mythran

 
Reply With Quote
 
John B
Guest
Posts: n/a
 
      13th Jul 2006
Calros Lo wrote:
> Dear all:
> I develop a programe that need when I get a string , such as "123" or
> "ABC",if I get string "123" and the system will help me to create new
> string "124" , if I get string "ABC" and the system will help me to create
> new string "ABD" , could somebody can help me how to programe it , thank you
> very much.
>
> I don't know to how to covert string as ASCII and add integer value and
> covert the integer back to string, hope can support me the code I'll very
> appricate, thanks.
>
>

string s = "abc";
char subChar = s[2]; // last character
subChar++;
Console.WriteLine(s.Substring(0,2) + subChar);

HTH

JB
 
Reply With Quote
 
Calros Lo
Guest
Posts: n/a
 
      13th Jul 2006
Dear all:
I develop a programe that need when I get a string , such as "123" or
"ABC",if I get string "123" and the system will help me to create new
string "124" , if I get string "ABC" and the system will help me to create
new string "ABD" , could somebody can help me how to programe it , thank you
very much.

I don't know to how to covert string as ASCII and add integer value and
covert the integer back to string, hope can support me the code I'll very
appricate, thanks.


 
Reply With Quote
 
Calros_Lo
Guest
Posts: n/a
 
      13th Jul 2006
Hi Mythran
Can you point me , If I get string "ABZ" do you have any solution , if I
get it.
I think If I get string "ABZ" I want convert it as "ABZA" can you help me to
programe
how to write it, thank you very much.

"Mythran" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>
> "Calros Lo" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Dear all:
>> I develop a programe that need when I get a string , such as "123" or
>> "ABC",if I get string "123" and the system will help me to create new
>> string "124" , if I get string "ABC" and the system will help me to
>> create new string "ABD" , could somebody can help me how to programe it ,
>> thank you very much.
>>
>> I don't know to how to covert string as ASCII and add integer value and
>> covert the integer back to string, hope can support me the code I'll very
>> appricate, thanks.
>>

>
> What happens when "ABC" eventually becomes "ABZ"? Does the previous
> letters get up'ed? Such as "ACA"? If so, what happens at "ZZZ"? Does it
> become "AAAA" or "ZZZA"? Need more info if we are to help
>
> Mythran
>



 
Reply With Quote
 
Ignacio Machin \( .NET/ C# MVP \)
Guest
Posts: n/a
 
      13th Jul 2006
Hi,


"Calros_Lo" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Mythran
> Can you point me , If I get string "ABZ" do you have any solution , if I
> get it.
> I think If I get string "ABZ" I want convert it as "ABZA" can you help me
> to programe


Well if you do not know what to do in that case maybe you want to rethink
the entire thing over

Start with thinking why are you doing it and what you want from it.



Un Saludo,

--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


 
Reply With Quote
 
Calros Lo
Guest
Posts: n/a
 
      13th Jul 2006
Hi~
Thank for you point my problem, I consider that If I get the string of end
letter is"Z" I'll take ignore, in other word If I get string "ABZ" than keep
the string orginal "ABZ" or not do anything.

I just want to know how If I get "123" than get "124" thanks everybody, I
will appreaciate.



"Mythran" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>
> "Calros Lo" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Dear all:
>> I develop a programe that need when I get a string , such as "123" or
>> "ABC",if I get string "123" and the system will help me to create new
>> string "124" , if I get string "ABC" and the system will help me to
>> create new string "ABD" , could somebody can help me how to programe it ,
>> thank you very much.
>>
>> I don't know to how to covert string as ASCII and add integer value and
>> covert the integer back to string, hope can support me the code I'll very
>> appricate, thanks.
>>

>
> What happens when "ABC" eventually becomes "ABZ"? Does the previous
> letters get up'ed? Such as "ACA"? If so, what happens at "ZZZ"? Does it
> become "AAAA" or "ZZZA"? Need more info if we are to help
>
> Mythran
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Covert string to System.Guid, how?? Jeff Microsoft ASP .NET 2 16th Apr 2007 05:10 PM
Covert string to date, etc MCI Microsoft Excel Misc 1 8th Dec 2006 06:25 PM
How to covert an Oracle GUID to string ? =?Utf-8?B?RnJlZGR5Ym95?= Microsoft ADO .NET 2 27th Nov 2006 08:24 AM
Covert UTC String to UTC Datetime =?Utf-8?B?aGVuaw==?= Microsoft ASP .NET 3 7th May 2006 07:25 PM
Decimal or String Covert to Hex Value Michael Chong Microsoft VC .NET 1 15th Sep 2004 02:25 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:46 AM.