wood burning stoves*
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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: 30076
    
149

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
 
It is sorta covered in the JavaRanch Style Guide.
 
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