These are the instruction for the exercise I am supposed to do: Start with a prompt that asks the user to enter any string. Using a for loop, go through each character in the string. If the string contains the letter A (capital or lowercase), break out of the loop and print the message below to the screen. If the
Tag: string
Regex to accept only 5 numbers and then a dash or a letter on typescript
I am dealing with an issue with Regex. I have a input which has maxLength 10. I achieved till now to have the first given value can be digits for example 12345 but then it waits for a dash and after it you can write a letter or again a number maxLength=10 for example: 12345-a121 is allowed and it works
useState react error Too many re-renders mergin state props input
I am having problems with updating state by mergin selected input props in one string in order to pass a proper path with values to API. I have something like this in logic : The purpose of the code is to get two strings values from the form component (I am using Formik) and this actually works just fine. But
Removing “,” at the beginning of a line CSV
i want to convert a .csv file and write a new one. However I am not able to remove the first , i am kinda stuck here and it is driving me crazy. This is my code: That’s the output i am getting in the newly generated file Output extractedtasks: Output extractedtasksformated: Answer Because extractedtasks is an array, instead of
regex replace for multiple string array javascript
I have a array of string and the patterns like #number-number anywhere inside a string. Requirements: If the # and single digit number before by hyphen then replace # and add 0. For example, #162-7878 => 162-7878, #12-4598866 => 12-4598866 If the # and two or more digit number before by hyphen then replace remove #. For example, #1-7878 =>
Unable to read the value of input text in arabic language in the same way I typed in Javascript
I am trying to read the value of an input text field entered in the Arabic language using javascript. But as you can see in the screenshot it’s not fetching the text in the same way I typed. The number ‘123’ which is on the right side of the input field is jumping to the left side when I try
How to compare two arrays of strings, find all matches, when there might be a sentence?
This is a fun one – I am building a profanity checker! For the purposes of this exercise, let’s have an array of forbidden words, like so: const forbiddenWords = [‘apples’, ‘oranges’, ‘blue carrots’, ‘mushy green peas’]; Then I will have an input field for a user to input the something. It could be an infinite combo of words, but
What is the appropriate use for the .replace method within this context/ within a .map method?
I’m trying to loop through an array of strings and for each element(string) in that array, change the character after the “_” underscore character to a “*” character. Strings are immutable so, pushing this all to a new array. The chain performs as expected when directly targeting the underscore for replacement: But the moment the actual intended function is pursued,
Parse nested object in JSON string
I have this code: It of course fail because in values I have an object. Is there any option how to parse this string in easy way? Or is it not possible at all? At the end the result should be: Answer The string is incorrect:
Trying to compare a string value from database(firestore) to a inputted string from a text field. im using vue framework
ignore all the commented out console logs, anyways, i tried setting both to a variable, i tried doing it by straight comparing this.username to the one in database. its getting the username from the database correctly, ive console logged it and it worked fine, outputted all the usernames from database. however at the if statement, it will not compare them