Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

How to format a string in OPL

  • 1.  How to format a string in OPL

    Posted 12/12/18 05:59 PM

    Originally posted by: Krishnendu Mukherjee


    Hi,

            I am quite inquisitive to format a string as per my requirement. For instance, I want to format a given string "B0" to make "B". How to remove trailing "0"? 

            Please share code in OPL.

     

    Thanks,


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: How to format a string in OPL

    Posted 12/13/18 01:20 AM

    Hi,

    you could use the scripting part:

    string s="B0";
     
     execute
     {
     s=s.substring(0,s.length-1);
     writeln(s);
     }

    regards

     

    PS: Many how to at https://www.linkedin.com/pulse/how-opl-alex-fleischer/


    #DecisionOptimization
    #OPLusingCPLEXOptimizer