All Questions
44 questions
0
votes
1
answer
161
views
String between two "*" or "_" characters not getting bold or italic
Suppose there is string wrapped with two * characters (from both starting and ending). The resulting string should be converted in bold text, similarly as when the string is wrapped with two ...
0
votes
1
answer
531
views
How do I convert special characters like: " into chracters like: " with JS?
I found these string things (idk what to call them) from a json database and I noticed that it was writing those letters instead of the actual character. I undestand why, but I can't figure out how to ...
0
votes
3
answers
72
views
Javascript capitalizing string after 2 characters
I have an address that looks like this:
3513 Jones Drive Apt #500a
How do I capitalize any characters that come after Ap to be all caps. Including the a after the apartment number.
3513 Jones Drive ...
3
votes
2
answers
420
views
How to format a JavaScript string with replaceAll using regex
I am trying to format a kind of a board game notation which consists of tabs and spaces.
The original string is looking like this:
1. \td11-d9 \te7-e10 \n2. \ta8-c8 \tg7-g10xf10 \n3. ...
0
votes
4
answers
281
views
String (double quote) formatting in Javascript
I have a string
var st = "asv_abc1_100x101, asv_def2_100x102, asv_ghi1_100x103, asv_jkl4_100x104"
Now I want to put a double quote around each substring
i.e required string
var st = "&...
0
votes
2
answers
222
views
How to apply custom formatting for a JSON stringify?
I have the following code:
const sample = [
{
name: "apple",
points: [ { x: 1, y: 2 }, { x: 3, y: 4 }, { x: 5, y: 6 }, { x: 7, y: 8 } ],
age: 24
},
{
name: "banana",
...
0
votes
2
answers
399
views
How to change date format of JSON parsed data [duplicate]
In my parsed JSON data, I have a date that is being outputted like this:
SessionStartTime: "2022-04-14T08:30:00-07:00" and this is how it is being printed in my HTML.
How do I separate and ...
0
votes
1
answer
25
views
How do I format a string based on certain delimeters in reactjs?
Let a = "cat AND mouse AND hen OR pig AND cow OR horse"
Expected output ="((cat AND mouse AND hen) OR (pig AND cow) OR horse)"
All the consecutive AND should be inside a bracket.
1
vote
1
answer
53
views
Is there a elegant javascript equivalent of this python code using formatting?
Is there a javascript equivalent of this python code? I know you can use ``, but how can you combine it with ... spread operator?
'{}{}{} {}{}{}-{}{}{}{}'.format(*array)
array is list of length 10 of ...
1
vote
1
answer
58
views
How do I implement text formatting with rules?
Let me start with what we already know. JS Engine finds ${ ... } in `` and executes the expression inside, then puts whatever that returns as a string. Okay, this is build-in functionality:
const name ...
-1
votes
2
answers
760
views
How to make a part of string bold?
I have this html>select lists which gives u a quick review of the item but there is this one specific
part of the string where i wanna make a word bold but not working anyways. I have come across a ...
0
votes
0
answers
12
views
Format new Date().toGMTString() to local date and a human readable format [duplicate]
I'm using javascript and hav a date string in GMT fromat, for example:
"Mon, 02 Nov 2020 15:12:31 GMT"
is there is a method to convert the string to a local date format and a human readable ...
0
votes
2
answers
408
views
Executing javascript in python results in KeyError
I'm having a hard time while trying to execute script in python selenium... I'm trying to check if certain element is in specified parent, and if it is, it should return true.
Here is my code:
...
8
votes
6
answers
31k
views
How to get last 2 digits of year from Javascript date [duplicate]
I have string in the following format "30.11.2019". I need to transform it into a Date and get the short year representation (last 2 digits from year) like "19".
The following code doesn't work
var ...
0
votes
1
answer
71
views
Formatting date to dd/MM/yyyy in this code [duplicate]
Ok fairly new to javascript entirely - I have the code below which is outputting the date in yyyy-MM-dd format. How would I go about converting this to UK format?
Apologies if this is a silly ...