Quantcast
Channel: Splitting company name into 3 strings - Code Review Stack Exchange
Browsing latest articles
Browse All 5 View Live

Answer by Bjørn-Roger Kringsjå for Splitting company name into 3 strings

Just for the fun of it, here's a one-liner using LINQ.Dim names = (From i In {0, 35, 70} Where i < input.Length Select input.Substring(i, Math.Min(35, (input.Length - i))))ExampleDim names As...

View Article



Answer by Malachi for Splitting company name into 3 strings

I like the_lotus first block of code, but I think you would want to remove the nested if statementsvar1 = companyNamevar2 = ""var3 = ""If var1.Length > 105 Then var3 = var1.Substring(70,105) var2 =...

View Article

Answer by BeetDemGuise for Splitting company name into 3 strings

Everything in moderationWhitespace can help make your code nice and readable. However, TOO much whitespace can make your code hard to read. You fall into the latter case: you have way too much...

View Article

Answer by the_lotus for Splitting company name into 3 strings

You don't need to loop. The function SubString and the property Length is enought to handle what you want. var1 = companyName var2 = "" var3 = "" If var1.Length > 35 Then var2 = var1.Substring(35)...

View Article

Splitting company name into 3 strings

I wrote an algorithm which should cut a companies name into 3 strings.Input: 1 StringOutput: 3 String.Conditions:String 1 2 and 3 shall not be longer then 35 signs. If the Input string is longer then...

View Article

Browsing latest articles
Browse All 5 View Live




Latest Images