extJS didnt see too big text with many <\br>'s..
If i write text something like "lalal lalalal lsadsdhas afjhjhj";
Its okei, works.
If i write text with \n (<\br>) something like:
"hello,
my name
is Polly!";
ExtJS didnt see those lines. How i can avoid this?
Thank you!
This is because Javascript doesn't allow multi-line strings. If you want a linebreak in your string, it has to be coded with an escape sequence like '\r\n'. So,
alert("hello, \r\nmy name\r\nis Polly!");
will display as 3 lines. If the string is going into an html element, then insert '<br />' in place of the '\r\n'.
finally, if you need a long string with lots of blank spaces between the words, for some reason, you can either keep typing on the same line, or break it up into several lines and combine the lines with the '+' operator, like this:
var longstring =
'hello \r\n'
+'my name \r\n'
+'is Polly!';
Related
I would like to create a User Snipper in VS Code that is a combination of variables and plaint text. This can typically be achieved by combining variables and plain text with a whitespace between then. But I would like to ad a variable next to a text without a whitespace.
For Example, I would like to create the current timestamp like this:
2022-02-19T21:02:24-0530
Below is what I tried
$CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATET$CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND-0530
Notice the T in between $CURRENT_DATE & $CURRENT_HOUR
OUTPUT:
2022-02-CURRENT_DATET21:06:12-0530
You can add $ symbol before the plain-text you want to add.
In this case, you need at add $T instead of T
$CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE$T$CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND-0530
Note that $T will get considered as a placeholder, and it will be the last item selected while tabbing through the inserted snippet.
I'm using a regex to validate a form input. So basically a user can input "SELECT some_name of select_match".
So far I have the regex: \bSELECT\b \bof select_match\b
The last part is the middle part, which I think should be [a-zA-Z] but I'm not sure how to place it in the middle. I've read multiple pages but can't get it to work.
Also preferably I'd like the regex to ignore spaces between "SELECT" and of "select_match". Meaning that SELECT blabla of select_match and SELECT blabla of select_match would both be validated as correct.
Can anyone tell me how to do this? Thank you.
If I understood you correctly, this should work:
/^SELECT\s+(\w+)\s+of select_match$/
Notes:
This allows any number of spaces between "SELECT" and the match_name; and between the match_name and the "of" (but, at least 1. To change to at least 0, change the \s+ to a \s*)
After that, the rest of the string must be exactly like that (same spaces and words exactly).
The match_name will be in match group 1.
If this doesn't work, show a bit of your code (where you use it) and we can try to find the problem.
Note: If you are using it in ng-pattern lose the "/"s (being the pattern: ^SELECT\s+(\w+)\s+of select_match$).
Note2: If you are using it in a string, remember you might need to escape every "\" (making it a "\", and the result: ^SELECT\\s+(\\w+)\\s+of select_match$
So I'm programming and I want to show my first name and last name but i want my last name on a new line. Of course I use the function \n right after my first name. In WPF it shows it like how it should be shown:
first name
last name
If I now want to show this through a report with SSRS this will not work cause my report will show first name \n last name. Is there anyway that report builder will understand this function and give me the same representation like in WPF?
I don't think it will ever understand "\n". Instead of "\n", use "vbcrlf" - that sticks in a carriage return and drops the text to a new line.
You can just encase the field with your text with the below:
=Replace(Fields!<<fieldname>>.Value, "\n", vbcrlf)
Make sure the text is not set to interpret tags as HTML and you'll be fine.
I have a text file that I read using the usual URLRequest and URLloader functions. It consists of a series of names, each separated by \r\d. I want to create an array of those names, but I want to eliminate both the \r and the \d. This code does a great job at splitting the names into arrays, but it leaves the carriage return in the string.
names = testfile.split(String.fromCharCode(10));
And this leaves the new line:
names = testfile.split(String.fromCharCode(13));
I'm mainly a C/C++/assembly programmer, AS3 has some things that seem rather odd to me. Is there a way to do this? I've tried searching the resulting string array members but I get errors from the compiler. Very easy to do in C/C++/assembly, but I haven't quite figured AS3 out yet.
You should be able to use a RegExp to do this. Something like:
var noLines:String = withLines.replace( /[\r\n]/g, "" );
That'll remove all new lines from your string; whether you want to do that before or after splitting it up to you.
If your string is in the form:
name1
name2
name3
Then you might even be able to get away with splitting using a RegExp:
var names:Array = withLines.split( /[\r\n]/ );
You can test out the RegExp provided here: http://regexr.com?38dmk (click on the replace tab and clear the replace input)
I would like display, in a textbox, the spaces and the carriage return in order to show the user the exact test formatting, ie using a central point for spaces and an arrow for CRLF. Any idea ?
Eah, it's really hard! But you can replace spaces with some printable symblos for display purposes only. But carriage you shouldn't replace, just add new Symbols.
And before text usage, before writing to file for example, just convert all symbols back to spaces.
This solutiond of course, is not universal and complete.