[Solved] How to prepend a word with a letter if the first letter of that word is upper-case?

Using a regex: string paragraphWord = “This is A String of WoRDs”; var reg = new Regex(@”(?<=^|\W)([A-Z])”); Console.WriteLine(reg.Replace(paragraphWord,”k$1″)); Explaining (?<=^|\W)([A-Z]) ?<= positive look behind ^|\W start of the string or a whitespace character [A-Z] A single upper case letter So we are looking for a single upper case letter proceeded by either the start of … Read more

[Solved] Split string on capital letter and a capital letter followed by a lowercase letter [closed]

I’m trying to give an answer that will help you understanding the problem and work on the solution. You have a string with capital letters and at some point there is a small letter. You want the string to be split at the position before the first small letter. You can iterate through the string … Read more

[Solved] How to check if there are 2 upper case letters, 3 lower case letters, and 1 number in JAVA

This looks like a homework question so I won’t solve it directly. However here are some steps you could take: Create a method to validate the input (public static boolean isValid(String str)) Convert the String to a character Array. (There’s a method for that!) Iterate over the letters and keep track of how many upper … Read more

[Solved] Convert first 2 letters of all records to Uppercase in python

You may use map and Convert you data as you required: try below: import pandas as pd df = pd.DataFrame({‘name’:[‘geeks’, ‘gor’, ‘geeks’, ‘is’,’portal’, ‘for’,’geeks’]}) df[‘name’]=df[‘name’].map(lambda x: x[:2].upper()+x[2:]) print (df) output: name 0 GEeks 1 GOr 2 GEeks 3 IS 4 POrtal 5 FOr 6 GEeks demo 1 solved Convert first 2 letters of all records … Read more

[Solved] .upper not working in python

The .upper() and .lower() functions do not modify the original str. Per the documentation, For .upper(): str.upper() Return a copy of the string with all the cased characters converted to uppercase. For .lower(): str.lower() Return a copy of the string with all the cased characters converted to lowercase. So if you want the uppercase and … Read more

[Solved] Powershell & Regex – How to find and delete uppercase characters from file names in directory [closed]

since this got answers, for full clarity: Remove -WhatIf when you’re running it. Get-ChildItem | Rename-Item -NewName {$_.Name -creplace “[A-Z]”} -WhatIf This pipes Get-ChildItem into Rename-Item and then Sets the NewName to be the old name, except we’ve case-sensitively replaced any capital letters with nothing. 3 solved Powershell & Regex – How to find and … Read more