adding a number to numbers in a sentence or a topic - numbers

I have a sentence (i may use a topic) like this:
George (98) Michael (65) Jim (53)... and so on.
I want a code in any programming language which add one (+1) to the numbers so the result comes as:
George (99) Michael (66) Jim (54)
I perhaps use arabic letters instead of english.
Thanks in advance.

In Ruby, if you want to find increment just the numbers in the string you can just call:
string.gsub(/(\d{1,})/) { |num| (num.next) }
This will find all the numbers in the string and increment them. Hope this helps

Related

How to sort list of cyrilic letters in flutter

I have list of cyrilic letters and I want to sort list alphabetically.
List<String> lst = ['Oбувь', 'Автомобильные запчасти'];
when I use codeUnitAt with 'A' it returns 1040, but with 'O' returs 79. How can I solve it?
I think that I can create custom Map for cyrilic alphabet, but at first I want to find other solutions.
The O in your string is not a cyrrilic O but a latin O. Try copying the following character to get a cyrillic O:
О
I faced this type of situation a lot. That's why i have a solution about it on my blog. Take a look through this link https://telegra.ph/Flutterda-Kirill-Lotin-Translator-06-03.
Also on github https://gist.github.com/jafar260698/b1b0c9963521dbff8a1606393f2ca7f2
I hope you may find it helpful.

DataFactory - Remove CR and LF characters

I have a CSV file source that has a field containing "CR" and "LF" type escape characters.
I'm trying to use a DataFlow and Derived Column to remove the unwanted characters but its not exactly working.
Here is my input with the unwanted escape chars
I'm using this expression against the synopsis column:
regexReplace(regexReplace(synopsis, `[\n]`, ''),`[\r]`, '')
As suggested in this similar post - How to replace CR and LF in Data Factory expressions
But I'm still getting some LF chars, but also a lot of extra commas.
Here is my output still with LF and extra Commas
Original in text format:
"TTL-100912","False",,"Bad Guys, The","GEN-ANI",,"Nobody has ever failed so hard at trying to be good as The Bad Guys.
In the new action comedy from DreamWorks Animation, based on the New York Times best-selling book series, a crackerjack criminal crew of animal outlaws are about to attempt their most challenging con yet--becoming model citizens.
Never have there been five friends as infamous as The Bad Guys--dashing pickpocket Mr. Wolf (Academy Award® winner Sam Rockwell, Three Billboards Outside Ebbing, Missouri), seen-it-all safecracker Mr. Snake (Marc Maron, GLOW), chill master-of-disguise Mr. Shark (Craig Robinson, Hot Tub Time Machine franchise), short-fused "muscle" Mr. Piranha (Anthony Ramos, In the Heights) and sharp-tongued expert hacker Ms. Tarantula (Awkwafina, Crazy Rich Asians), aka "Webs." The film co-stars Zazie Beetz (Joker), Lilly Singh (Bad Moms) and Emmy winner Alex Borstein (The Marvelous Mrs. Maisel).
Based on the blockbuster Scholastic book series by Aaron Blabey, THE BAD GUYS is directed by Pierre Perifel (animator, the Kung Fu Panda films), making his feature-directing debut. The film is produced by Damon Ross (development executive Trolls, The Boss Baby, co-producer Nacho Libre) and Rebecca Huntley (associate producer, The Boss Baby). The executive producers are Aaron Blabey, Etan Cohen and Patrick Hughes. ",,"BAD GUYS, THE","Bad Guys, The",,,,"2021-10-12 15:39:24",,
The way the source file was being produced was my complicating factor.
I changed the Row Delimiter in the production of my source csv to "¬" from "," and then was able to use this expression in a data flow to clean the contents of the Synopsis field:
regexReplace(synopsis, ',|[\n]|[\r]', ' ')

Two digits after the decimal point in a real number in Pascal

So for an example i have a real number let's say 17.4578 but i want to display it in pascal with only two digits after the point so it's 17.45.
What do i write in my program?
Write(17.4578:0:2)
Will display number 17.46
Generally, arguments look like this → Value : field_width : decimal_field_width
For more info click here
This would work. However, if this is the last line of code always remember a readln at the end.
Writeln(17.4578:0:2)
This would lead to 17.46 because it rounds up as it is followed by a 7.
Hope this helps
Use :0:2 at the end of Real number:
writeln(17.4578:0:2)

Is a character in a variable is a letter or number

I would like to find out how you can tell if a character in a variable is a letter or number
for example:
if I used the code: ABC123
How would I find out if a variable followed that pattern so if a inputted code would be DNM567 it would print "correct"
But if a code was DNM56T it would print "incorrect".
Many thanks
You can use regular expressions, or linearly scan the character array to ensure that no letter comes after a number.
More information about the question would be helpful.
you can use regular expression:
if(Regex.IsMatch(myString, "^[A-Za-z]{3}[0-9]{3}$"))
{
// you got the right pattern...
}
edit: this is C# but regular expression can be found in almost any OOP language out there.

Iphone work out if string is a UK Postcode

In my app before I send a string off I need to work out if the text entered in the textbox is a UK Postcode. I don't have the regex ability to work that out for myself and after searching around I can't seem to work it out! Just wondered if anyone has done a similar thing in the past?
Or if anyone can point me in the right direction I would be most appreciative!
Tom
Wikipedia has a good section about this. Basically the answer depends on what sort of pathological cases you want to handle. For example:
An alternative short regular expression from BS7666 Schema is:
[A-Z]{1,2}[0-9R][0-9A-Z]? [0-9][ABD-HJLNP-UW-Z]{2}
The above expressions fail to exclude many non-existent area codes (such as A, AA, Z and ZY).
Basically, read that section of Wikipedia thoroughly and decide what you need.
for post codes without spaces (e.g. SE19QZ) I use: (its not failed me yet ;-) )
^([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([A-Za-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9]?[A-Za-z])))) [0-9][A-Za-z]{2})
if spaces (e.g. SE1 9QZ) , then:
^([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([A-Za-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9]?[A-Za-z])))) {0,1}[0-9][A-Za-z]{2})$
You can match most post codes with this regex:
/[A-Z]{1,2}[0-9]{1,2}\s?[0-9]{1,2}[A-Z]{1,2}/i
Which means... A-Z one or two times ({1,2}) followed by 0-9 1 or two times, followed by a space \s optionally ? followed by 0-9 one or two times, followed by A-Z one or two times.
This will match some false positives, as I can make up post codes like ZZ00 00ZZ, but to accurately match all post codes, the only way is to buy post code data from the post office - which is quite expensive. You could also download free post code databases, but they do not have 100% coverage.
Hope this helps.
Wikipedia has some regexes for UK Postcodes: http://en.wikipedia.org/wiki/Postcodes_in_the_United_Kingdom#Validation