C#: How to detect . in string and insert a space after it/How to insert space after n chars?

Posted by Sam Gentile on Stack Overflow See other posts from Stack Overflow or by Sam Gentile
Published on 2011-02-23T14:51:08Z Indexed on 2011/02/23 15:24 UTC
Read the original article Hit count: 246

Filed under:
|
|

Suppose I have a long string like "4600airportburlingame150anzablvd.burlingamecalifornia94010". My code is breaking on this string. This is UNUSUAL. 99% of entries will NOT have a period. The CSS in the browser wraps IF there are spaces in the string and there isn't any here.

  1. How do I detect the period (".") and insert a space directly after it? Remember 99% of strings will NOT have a period in them. The code has to detect if it has a period and if so, do the insertion, otherwise not.
  2. If I determine a maximum string length, how do I insert a space at some length?

Thanks

© Stack Overflow or respective owner

Related posts about c#

Related posts about string