sharepoint - Convert "float;#22.0000000000000" into just "22.0" in C# -


i'm doing tostring() on object , output getting float;#22.0000000000000. need 22.0.

how achieve in c#?

additional info: object value number column in sharepoint list. value being retried in code caml query. i'm sure it's use of caml query that's causing me issue. if retrieve item iterating through items in list don't have issue, approach not efficient caml query.

update:
seems not tostring() that's causing output. object i'm calling tostring() on seems set float;#22.0000000000000, what's coming straight out of caml query.

use given code 22.0

string value = "float;#22.0000000000000"; var number = value.split('#')[1]; double num = double.parse(number); console.writeline(num.tostring("0.0")); 

result: 22.0

mentioned code should work.

item.getformattedvalue("columnname") 

or try post

https://social.msdn.microsoft.com/forums/office/en-us/fdef03db-9678-46cf-8ff7-03551f4b8466/how-to-convert-a-decimal-number-field-to-c?forum=sharepointdevelopmentprevious


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -