my dog learned polymorphism*
The moose likes HTML, CSS and JavaScript and the fly likes Inserting a character Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Inserting a character" Watch "Inserting a character" New topic
Author

Inserting a character

Kedar Dravid
Ranch Hand

Joined: May 28, 2004
Posts: 333
Given a Javascript variable containing a String, what is the easiest way to insert a character at a specific position in the String?
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30123
    
150

Kedar,
The easiest way I can think of is to create two substrings and then concatenate all the strings thogether:


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Inserting a character
 
Similar Threads
Regex
character array
Question 9, Chapter 6 in K&B
Parsing String to Integer if it is a Number or keeping as String itself
Aggregation and Generalization