473,396 Members | 1,676 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Replace a letter in a string

Suppose that you have a string e.g. "delicious" and an integer e.g. 5. How
to
replace the character at position 5 with next character (in position 6) so
that "delicious" becomes "deliicous" ?

Nov 20 '05 #1
4 1638
NM
I suggest that :

Dim myWord As String = "delicious"

Dim myWordInChar As Char() = myWord.ToCharArray()

Dim tmp As Char = myWordInChar(4)

myWordInChar(4) = myWordInChar(5)

myWordInChar(5) = tmp

myWord = New String(myWordInChar)

"Dinko Deranja" <dd******@public.srce.hr> a écrit dans le message de
news:%2****************@tk2msftngp13.phx.gbl...
Suppose that you have a string e.g. "delicious" and an integer e.g. 5. How
to
replace the character at position 5 with next character (in position 6) so
that "delicious" becomes "deliicous" ?

Nov 20 '05 #2
NM
I suggest that :

Dim myWord As String = "delicious"

Dim myWordInChar As Char() = myWord.ToCharArray()

Dim tmp As Char = myWordInChar(4)

myWordInChar(4) = myWordInChar(5)

myWordInChar(5) = tmp

myWord = New String(myWordInChar)

"Dinko Deranja" <dd******@public.srce.hr> a écrit dans le message de
news:%2****************@tk2msftngp13.phx.gbl...
Suppose that you have a string e.g. "delicious" and an integer e.g. 5. How
to
replace the character at position 5 with next character (in position 6) so
that "delicious" becomes "deliicous" ?

Nov 20 '05 #3
Cor
I go for

dim a as string = "delicious"
dim b as string = a.substring(0,4) & a.substring(3)

Cor
Suppose that you have a string e.g. "delicious" and an integer e.g. 5. How
to
replace the character at position 5 with next character (in position 6) so
that "delicious" becomes "deliicous" ?

Nov 20 '05 #4
Cor
I go for

dim a as string = "delicious"
dim b as string = a.substring(0,4) & a.substring(3)

Cor
Suppose that you have a string e.g. "delicious" and an integer e.g. 5. How
to
replace the character at position 5 with next character (in position 6) so
that "delicious" becomes "deliicous" ?

Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Nicolas Bouillon | last post by:
Hi I would like to replace accentuel chars (like "é", "è" or "à") with non accetued ones ("é" -> "e", "è" -> "e", "à" -> "a"). I have tried string.replace method, but it seems dislike...
3
by: Claude Schneegans | last post by:
Hi, I'trying to use a regExp in Javascript to replace any all upper case word in a string by the same word having only its first letter in upper case. This expression detects the words: /()(+)/g...
22
by: Phlip | last post by:
C++ers: Here's an open ended STL question. What's the smarmiest most templated way to use <string>, <algorithms> etc. to turn this: " able search baker search charlie " into this: " able...
3
by: Raed Sawalha | last post by:
I have the following letters; string letters = "a;b;c....to z"; the I need to replace the incoming string which containing letters above with integer 1 i did following for(int...
4
by: jgabbai | last post by:
Hi, What is the best way to white list a set of allowable characters using regex or replace? I understand it is safer to whitelist than to blacklist, but am not sure how to go about it. Many...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.