You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by sars84 <sa...@googlemail.com> on 2013/01/09 17:21:56 UTC
How to get the CellValue from a Cell as String
Hallo All,
Is a Text from a Cell not equal to a String? I mean, I have;
String G = cell.getRichStringCellValue().getString(); // Output :Caption
or
String B = cell.getStringCellValue(); // Output:Caption
but wenn I do ;
String Caption = "Caption";
if (G == Caption){System.out.println("OK");}
if (B == Caption){System.out.println("OK");}
it doesn't work?
How can i match a String with the Value (a String Value) from a Cell?
Thanks in advance
Sars
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/How-to-get-the-CellValue-from-a-Cell-as-String-tp5711810.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: How to get the CellValue from a Cell as String
Posted by sars84 <sa...@googlemail.com>.
Thank you very much Gandhi!
It works.
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/How-to-get-the-CellValue-from-a-Cell-as-String-tp5711810p5711812.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: How to get the CellValue from a Cell as String
Posted by "Gandhi, Kunal - External" <KG...@sjm.com>.
Do
B.equals(Caption) and not using == operator. When you use the == operator on Strings you are comparing the Strings starting address in memory, ie the address in memory of the first letter in the string.
On Jan 9, 2013, at 10:26, "sars84" <sa...@googlemail.com> wrote:
> Hallo All,
>
> Is a Text from a Cell not equal to a String? I mean, I have;
>
> String G = cell.getRichStringCellValue().getString(); // Output :Caption
>
> or
>
> String B = cell.getStringCellValue(); // Output:Caption
>
> but wenn I do ;
>
> String Caption = "Caption";
> if (G == Caption){System.out.println("OK");}
> if (B == Caption){System.out.println("OK");}
>
> it doesn't work?
> How can i match a String with the Value (a String Value) from a Cell?
>
> Thanks in advance
> Sars
>
>
>
>
>
> --
> View this message in context: http://apache-poi.1045710.n5.nabble.com/How-to-get-the-CellValue-from-a-Cell-as-String-tp5711810.html
> Sent from the POI - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
This communication, including any attachments, may contain information that is proprietary, privileged, confidential or legally exempt from disclosure. If you are not a named addressee, you are hereby notified that you are not authorized to read, print, retain a copy of or disseminate any portion of this communication without the consent of the sender and that doing so may be unlawful. If you have received this communication in error, please immediately notify the sender via return e-mail and delete it from your system.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org