Tag Archives: replace

Want to replace WhiteSpace from array of String

Questions: private static final String SQL_INSERT = “INSERT INTO ${table}(${keys}) VALUES(${values})”; private static final String SQL_CREATE = “CREATE TABLE ${table}(${keys} VARCHAR(20) NOT NULL)”; private static final String TABLE_REGEX = “\\$\\{table\\}”; private static final String KEYS_REGEX = “\\$\\{keys\\}”; private static final String VALUES_REGEX = “\\$\\{values\\}”; String[] headerRow = csvReader.readNext();//getting(Machine Name , Value) String[] stripedHeaderRow = StringUtils.stripAll(headerRow);… Read More »

Value of tooltip replaced for last foreach value

Questions: I have an event to get Tooltip text in column chart like: empChart.GetToolTipText += empChart_GetToolTipText; then method is like: private void empChart_GetToolTipText(object sender, ToolTipEventArgs e ) { if (e.HitTestResult.ChartElementType == ChartElementType.DataPoint) { Chart senderChart = (Chart)sender; var series = senderChart.Series; var points = e.HitTestResult.Series.Points; foreach (var s in series) { var finalString = s.LegendToolTip.Replace(“\r”,… Read More »

String replace with exact match word based on a key present in a queryurl

Questions: When someone get rest method called by using below url hit the controllerMethod. For example URL string like: String queryurl=http://localhost:8081/servcie/details?id=101&type=124; String changedQueryUrl=null; @GetMapping(value = “details”) public MyModel controllerMethod(@RequestParam Map<String, String> customQuery,HttpServletRequest request) { //i have to replace words “id” with rollNo and “type” with datatype // so that i have done below sample code… Read More »

C# Find and replace a price in a long string

Questions: I have a long string representing a web page in html, I have to change the price of a product detail, the string to be replaced would be like this: 10.20 € or 100.22 € or 1.50 € etc. the price may vary so the replace must work with any amount. How can I… Read More »