Sanjay Sharma

Sanjay Sharma

  • 1.3k
  • 413
  • 27.3k

string replacement is any better way?

Jul 6 2018 9:21 AM

Hi,

I have formula string and I want to replace the key in string and the form another string for execution.

I can do that with lot of find replacement :( can any one suggest better way.

When I see Bonus in formula I should find Bonus(Key1) and use CalculatBonus get value and replace it

private static string GetBonus(string ForlumaString)

{

//ForlumaString = CASE WHEN POLICYYEAR = 1 THEN Bonus(Key1) ELSE Bonus(key2 ) * 2 END

//output

//CASE WHEN POLICYYEAR = 1 THEN 10 ELSE 20 * 2 END

return outputString;

}

private int CalculatBonus(string Key)

{

if (Key == "Key1")

return 10;

else

return 20;

}


Answers (1)