I'm working with morse code and I was wondering if it's possible to replace a space with a forward slash using jQuery?
Thanks
I'm working with morse code and I was wondering if it's possible to replace a space with a forward slash using jQuery?
Thanks
jQuery is wholly the wrong tool here. jQuery is a package built on top of JavaScript for manipulation of the DOM. You want string manipulation, which is just methods as part of the String prototype inside JavaScript:
var someString = "My String is Cool";
someString = someString.replace(' ','/');
alert(someString);
For this case, we're simply using one for one replacement (the character space is replaced by the character slash). More complex replacements may utilize regex or Regular Expressions, which again, is not jQuery.
If I interpret your question correctly, you want to know how to replace parts of a string (in your cases, spaces) with another string (a forward slash)? In that case, you might want to give String.replace() a try.
Here's a few examples: How to replace all occurrences of a string in JavaScript?