Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 11582

A string is a sequence of characters. It is commonly used to represent text or a sequence of bytes. Use this tag along with the appropriate programming language being used.

1 vote

Build a sentence from tokens / words in a String-Array

I would suggest using the strategy pattern rather than code for specific tokens. Because some of the operations are state dependent, you would probably create some kind of DetokenizerResult object. F …
Donald.McLean's user avatar
10 votes
Accepted

Is this String concatenation creating extra String?

Enter the mad world of optimization! The Java compiler and HotSpot just-in-time compiler are programmed with a great many rules for optimizing performance of Java code. In general, it is NOT worth y …
Donald.McLean's user avatar
5 votes

Checking whether a string is a valid number

Well, my first instinct would be to apply a refactoring - specifically Replace Conditional With Polymorphism. To do this, create an interface with one method (isValidNumber works). Create four implem …
Donald.McLean's user avatar
6 votes
Accepted

Java Date formatter

The thing about Date is that there are so many different time zones, so many different "standard" ways of representing the date and even, in some places, completely different calendar systems. As a re …
Donald.McLean's user avatar
11 votes

Converting a number to the text representation

First of all, in tripleAsText the first check for value < SUBTWENTY.length is entirely superfluous. It does give improved performance in those cases where the value is < 20, but it also causes your co …
Donald.McLean's user avatar