Unanswered posts

#1 2012-04-27 12:10:05

Lmit
Member
Registered: 2012-04-20
Posts: 14

Usage of tMap

Tags: [tmap]

Hi All,

            I want to use a method isBlank() in tmap, i have written the routine also but getting error... am attaching the screen shot of my code....

Can any one give a better solution for this..It could be a greatful

Thanks In Advance
Lmit


Uploaded Images

Offline

#2 2012-04-27 12:16:19

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: Usage of tMap

Hi Lmit

What's the function of this method?

First, you forgot to import StringUtils.
Second, there is no isBlank() method in StringUtils.

Regards,
Pedro


Only Paranoid Survive.

Offline

#3 2012-04-30 06:38:15

Lmit
Member
Registered: 2012-04-20
Posts: 14

Re: Usage of tMap

Hi Pedro,

                Thank For your reply

isBlank() method is there in stringUtils which checks whether the string is whitespace, empty ("") or null.

the function of the method (which i want is)
I want to check whether is string is null or not.


Thanks,
Lmit

Offline

#4 2012-05-02 08:38:12

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: Usage of tMap

Hi Lmit

Sorry for my delay to answer.

Last time I imported routines.system.StringUtils. I think what you need is to import org.apache.commons.lang.StringUtils which contains isBlank() method.

Regards,
Pedro


Only Paranoid Survive.

Offline

#5 2012-05-02 10:09:06

janhess
Member
Company: Newcastle University
Registered: 2009-05-19
Posts: 1123

Re: Usage of tMap

You appear to have an error in isBlank.

    public static boolean isBlank(String str) {
    int strLen;
    if (str == null || (strLen = str.length()) == 0) {
    return true;
    }
    for (int i = 0; i < strLen; i++) {
    if ((Character.isWhitespace(str.charAt(i)) == false)) {
    return false;
    }
    }
    return true;
    }

Last edited by janhess (2012-05-02 10:11:08)

Offline

#6 2012-05-02 11:58:16

Lmit
Member
Registered: 2012-04-20
Posts: 14

Re: Usage of tMap

Hi janhess

                  Thanks For your Replies..... your code will return a Boolean value but i want to return 0 or 1.


Thanks In Advance
LMIT

Offline

#7 2012-05-02 12:49:45

janhess
Member
Company: Newcastle University
Registered: 2009-05-19
Posts: 1123

Re: Usage of tMap

According to your example in the code picture you want to return true or false.

Offline

Board footer

Powered by FluxBB