How to split a CamelCase string in its substrings in Ruby?

s=”nowIsTheTime” s.split /(?=[A-Z])/ => [“now”, “Is”, “The”, “Time”] ?=pattern is an example of positive lookahead. It essentially matches a point in the string right before pattern. It doesn’t consume the characters, that is, it doesn’t include pattern as part of the match. Another example: irb> ‘streets’.sub /t(?=s)/, ‘-‘ => “stree-s” In this case the s … Read more

What if the string in the Java split is not found

You get an array of size 1 holding the original value: Input Output —– —— thirty-two {“thirty”, “two”} five {“five”} You can see this in action in the following program: class Test { static void checkResult (String input) { String [] arr = input.split (“\\-“); System.out.println (“Input : ‘” + input + “‘”); System.out.println (” … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)