Skip to main content
added 133 characters in body
Source Link

Holds calculation data. Builder pattern is used for readability in creation of the object. Slightly different from normal Builder Pattern. Please note that the use of the Builder pattern is not needed here. Simple accessors and setters backed my variable are needed.

Holds calculation data. Builder pattern is used for readability in creation of the object. Slightly different from normal Builder Pattern

Holds calculation data. Builder pattern is used for readability in creation of the object. Slightly different from normal Builder Pattern. Please note that the use of the Builder pattern is not needed here. Simple accessors and setters backed my variable are needed.

Clarified why I have commented out code
Source Link

PLEASE NOTE:

The code below has "commented out" code; however, no code is actually commented out!! Check my GitHub link below. I did that solely to highlight the relevant code sections. Code in my MainActivity and BaseCalculatorActivity, for example, are tightly linked to Android. Those are irrelevant to the alternative String.format() approach. What is important there is the Publish code; therefore, those sections are not commented out.


Original Question

Alternative String

  1. Get First NumberGet First Number
  2. Get Second NumberGet Second Number
  3. Update the resultUpdate the result

Alternative String

  1. Get First Number
  2. Get Second Number
  3. Update the result

PLEASE NOTE:

The code below has "commented out" code; however, no code is actually commented out!! Check my GitHub link below. I did that solely to highlight the relevant code sections. Code in my MainActivity and BaseCalculatorActivity, for example, are tightly linked to Android. Those are irrelevant to the alternative String.format() approach. What is important there is the Publish code; therefore, those sections are not commented out.


Original Question

Alternative

  1. Get First Number
  2. Get Second Number
  3. Update the result
deleted 25 characters in body; edited title
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238

Developed Fully Working Alternative-working alternative to String.format(...) | Has Reusability Issues

Goal

Code

Developed Fully Working Alternative to String.format(...) | Has Reusability Issues

Goal

Code

Fully-working alternative to String.format(...)

Reformatted question and added more code. Included most problem-specific code, but commented out non-essential code.
Source Link
Loading
Showed a secondary way of doing the formatting in the Expressions. My original code used a custom class, but more well-known Formatters can be used
Source Link
Loading
added 383 characters in body
Source Link
Loading
Source Link
Loading