You need to sign in to do that
Don't have an account?
Heiko Kramer
<key>value</key>
<key2>value</key2>
Somethimes there are linebreaks, so I get a null key added to the map. Got that solved with "key != null".
But I'm struggling with excluding no-values like <key></key>.
Probably easy, but I'm absulte beginner … can someone give me a hand here?
How to NOT add a Key with empty Value to a Map?
// Map to keep key (caregory) and value related to each other Map<String, String> mailValues = new Map<String, String>(); // Seperate keys and values and put it in the map List<String> listOfLines = plainText.split('\n'); for(String line : listOfLines){ String key = line.substringBetween('<', '>'); String value = line.substringBetween('<' + key + '>', '</' + key + '>'); if (key != null) { // this works just fine, null key not added // if (key != null || value != null){ // works partial, null key not added, but empty value added // if (key != null || value != ''){ // doesn't work at all, null key + empty value get added mailValues.put(key, value); }Hi guys, I'm getting tagged values per mail in this format:
<key>value</key>
<key2>value</key2>
Somethimes there are linebreaks, so I get a null key added to the map. Got that solved with "key != null".
But I'm struggling with excluding no-values like <key></key>.
Probably easy, but I'm absulte beginner … can someone give me a hand here?
Why not to use only , If (value != null) { ,in the second If statement. Using both key & value in the If statement will generate the key, value pair if any one is true.
All Answers
Why not to use only , If (value != null) { ,in the second If statement. Using both key & value in the If statement will generate the key, value pair if any one is true.
Although there is no space between the tags, the value is apparently not null.
Why not to use only , If (value != null) { ,in the second If statement. Using both key & value in the If statement will generate the key, value pair if any one is true. Hack Instagram
hi Heiko,
this coding is really sick because this is really old version i also creat a website with wordpress you can cheack it now thank you
AutoMartz (https://www.automartz.com)
attitude for girls (https://goodmorninglove.in/50-positive-attitude-quotes-in-hindi-and-english-for-girl)
good night (http://https://goodmorninglove.in/good-night-quotes/)
hindi love quotes (https://goodmorninglove.in/hindi-love-quotes/)
love shayari in hindi (https://goodmorninglove.in/love-shayari-hindi/)
good morning quotes (https://goodmorninglove.in/good-morning-quotes/)
Punjabi Song All Time Hit And favourite for everyone. we cut 30 second status videos from daily release new songs. you can update Punjabi Status (https://whatsappsongstatus.com/punjabi-status-videos) for you love one and husband wife we have latest collection of status song from singer diljit singh honey singh sidhu moosewala karan aujla jassi gill babbu mannn and other punjabi singer
Attitude Status: (https://www.hindiattitudestatus.in/2020/03/attitude-status-in-hindi-for-whatsapp.html)
Website: https://www.hindiattitudestatus.in
Top 2 Website for Sarkari Bank Jobs (https://www.sarkaribankjobs.com)
Ipbs po, Sbi Jobs, IBPS PO, IBPS Clerk, SBI Clerk visit: https://www.sarkaribankjobs.com