asp.net - array in tostring Convert type char to string -
i have code,but getting error.after change code.but wanted know correct.
modifiedmessage = converttoisofromutf8(modifiedmessage, "iso8859-1", "utf-8"); char[] characters_to_removed_from_start = { ' ' }; modifiedmessage = modifiedmessage.trimstart(characters_to_removed_from_start); string msg_arr = modifiedmessage.split(' '); string keyword = msg_arr[0]; //linq if (keyword != null) { string[] key = regex.split(msg_arr, @keyword).skip(0).toarray(); // message_in = string.join(message_in,key); message_in = string.join(msg_arr, key); modifiedmessage=""; } those errors shown error 1 cannot implicitly convert type 'string[]' 'string'
error 2 cannot implicitly convert type 'char' 'string'
then change code this..(only changed code listed below)
string msg_arr = modifiedmessage.split(' ').tostring(); string keyword = msg_arr[0].tostring(); i wanted know works correct ?
no, thats not correct, change
string msg_arr = modifiedmessage.split(' '); to
string[] msg_arr = modifiedmessage.split(' '); this resolve "error 1 cannot implicitly convert type 'string[]' 'string'"
and error 2 dissapears also
Comments
Post a Comment