10 examples of 'replace space with underscore in jquery' in JavaScript

Every line of 'replace space with underscore in jquery' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
26function underscore(string) {
27 return string ? trim(string + '').replace(RegExpNonAlphaNum, '_') : '';
28}
196export function stripUnderscore(string) {
197 const map = {
198 ASSEMBLY_COMPETITION: 'ASSEMBLY',
199 };
200 if (map[string]) {
201 return map[string];
202 }
203 if (!string) {
204 return '';
205 }
206 return string.replace(/_/g, ' ');
207}
492function underscore(str) {
493 if (str) {
494 var s = str.toLowerCase();
495 return s.replace(/ /gi, "_");
496 } else {
497 return "";
498 }
499
500}
170function alphanumericwithspacehyphenunderscore(obj){
171 if(jQuery(obj).val().match(regexp_alphanumerichyphenunderscore)){
172 jQuery(obj).val( jQuery(obj).val().replace(regexp_alphanumerichyphenunderscore,'') );
173 }
174}
84function underscore(str) {
85 return str.replace(STRING_UNDERSCORE_REGEXP_1, '$1_$2').
86 replace(STRING_UNDERSCORE_REGEXP_2, '_').toLowerCase();
87}
25export function underscore(str) {
26 return decamelize(str, '_')
27}
1export function camelCaseToUnderscore(s: string): string {
2 return s.replace(/(?:^|\.?)([A-Z])/g, (_, y) => `_${y.toLowerCase()}`).replace(/^_/, '');
3}
120export function fixSpaces(string, locale) {
121 string = removeMultipleSpaces(string, locale);
122 string = removeSpacesAtParagraphStart(string, locale);
123 string = removeSpaceBeforeSentencePausePunctuation(string, locale);
124 string = removeSpaceBeforeTerminalPunctuation(string, locale);
125 string = removeSpaceBeforeOrdinalIndicator(string, locale);
126 string = removeSpaceAfterPunctuation(string, locale);
127 string = addSpaceBeforePunctuation(string, locale);
128 string = addSpaceAfterPunctuation(string, locale);
129 string = removeTrailingSpaces(string, locale);
130 return string;
131}
215function camelize (str) {
216 return str.replace(/-(\w)/g, (_, c) => c ? c.toUpperCase() : '')
217}
43function camelize(str) {
44 return str.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function (match, index) {
45 if (+match === 0) return ""; // or if (/\s+/.test(match)) for white spaces
46 return index == 0 ? match.toLowerCase() : match.toUpperCase();
47 });
48}

Related snippets