Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

separating operator and character for encoding

$
0
0
In a url I have to encode the operators present in the dropdown combo box

string itemCode = (IsURLEncodingNeeded && URLEncodingType == ViewModel.URLEncodingType.HexEscaped) ? Uri.HexEscape((SelectedItem.ItemCode).ToCharArray()[0]): SelectedItem.ItemCode;
Parameters.Add(RequestObject.FieldedQueryStrings, (this.Key + ":" + itemCode));

In the above code I'm trying to encode the operators if its present in the dropdown combobox selected item "Uri.HexEscape((SelectedItem.ItemCode).ToCharArray()[0])"
Issue is for example if the selected item contains value as "A+" it is encoded as %41, in this case entire value gets encoded. but I need to encode the operators alone.that is I need to encode only "+" not "A+" which results as "%2B" correctly.

the combobox items will be received from backend it may contain any values like "AA+","B+","text"etc.. I just wanto seperate the operator present in the selecteditem value and encode it alone. how can it be done?

Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>