This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
pioncz derpina wrote:No, first char is '\\' and second is 'n'. I want to make one char from both of them - new line char.
So, you're saying if you encounter a '\' character followed by a 'n' character, you want to convert that to a '\n' character? If it's exactly that, then it's easy. However, if the '\' character can be used to escape itself for a literal '\', then it gets more difficult. That is, if the sequence 'a' '\' \n'\ 'b' needs to become 'a' '\n' 'b', but the sequence 'a' '\' '\' 'n' 'b' needs to become 'a' '\' 'n' 'b', then it's a little more work.
So here are more informaction.
I have file with some line (every file can have different lines).
This file looks like <string_to_search>|<string_to_past>
But there could be not only normal string, special chars could be there too (like new line so). This file can't look like:
So i decided to write special chars like they are normal: \n,\r or more. I will know when is special char because, first char is '\n'. So now i have problem, when first char is '\' how can i search for things in file like "\n". I have 2 ways: 1) make table with special chars, so when second character is 'n' i will search in file for special_chars (where it's exacly '\n'), but it's uglier way. 2) I will convert from this string with special char to char ("\n" to '\n' with some algorithm or function).