WCM - Das österreichische Computer Magazin Forenübersicht
 

Zurück   WCM Forum > Rat & Tat > Programmierung

Programmierung Rat & Tat für Programmierer

Microsoft KARRIERECAMPUS

Antwort
 
Themen-Optionen Ansicht
Alt 18.11.2005, 10:35   #1
athropos
Hero
 
Registriert seit: 24.07.2001
Alter: 46
Beiträge: 801


athropos eine Nachricht über Skype™ schicken
Standard Java String.toUpperCase()

Hallo!

ich habe folgendes Problem: wenn ich API richtig verstanden habe, sollte
Zitat:
input = String.toUpperCase(input);
mir den String input als groß geschriebenen String zurückliefern. Leider wirft mir das Programm eine Exception:
Zitat:
The method toUpperCase(Locale) in the type String is not applicable for the arguments(String)
Wieso nimmt er die Methode mit Locale, wenn es ohne doch eigentlich auch gehen sollte und wie kann ich das Ganze richtigstellen, daß es auch funktioniert? (mit dem Locale seh ich mich nicht ganz hinaus)

thx & lg, Athropos
____________________________________
Einstein, Pascal and Newton are playing hide and seek. Einstein is \"it\" so he faces the wall, closes his eyes and counts to π.
Pascal runs off like an idiot but Newton pulls out a piece of chalk and draws a 1m x 1m square on the ground and then stands in it\'s centre.

Einstein\'s done counting and turns around and sees Newton, so he grabs him and screams \"I found Newton!\"

Then Newton smirks and says, \"I\'m not Newton, I\'m Pascal\".
athropos ist offline   Mit Zitat antworten
Alt 18.11.2005, 12:10   #2
jak
Inventar
 
Registriert seit: 13.06.2001
Beiträge: 1.830


Standard

toUpperCase ist keine static Methode, d.h. sie ist keine Methode der Klasse String sondern der Objekte der Klasse String.
Du rufst sie also nicht über
String.toUpperCase(String s); auf (wie es z.B. bei Integer.parseInt(String s) passiert) sondern mit
String s = "asdfs";
String s2 = s.toUpperCase();
oder bei dir:
input = input.toUpperCase();

Nachdem du einen Parameter übergibst, denkt Java du meinst die Methode
toString(Locale l); die (vereinfacht gesagt) dafür sorgt, daß du z.B. kyrillische Zeichen in Großbuchstaben umwandeln kannst.

jak
____________________________________
Join the DNRC | Godwin\'s Law (thx@stona)
Documentation is like sex: If it\'s good, it\'s very, very good. If it\'s bad, it\'s better than nothing.
\"In theory, theory and practice are the same. In practice, they are not\" (Lawrence Berra)
jak ist offline   Mit Zitat antworten
Alt 18.11.2005, 12:23   #3
athropos
Hero
 
Registriert seit: 24.07.2001
Alter: 46
Beiträge: 801


athropos eine Nachricht über Skype™ schicken
Standard

DANKE!!

____________________________________
Einstein, Pascal and Newton are playing hide and seek. Einstein is \"it\" so he faces the wall, closes his eyes and counts to π.
Pascal runs off like an idiot but Newton pulls out a piece of chalk and draws a 1m x 1m square on the ground and then stands in it\'s centre.

Einstein\'s done counting and turns around and sees Newton, so he grabs him and screams \"I found Newton!\"

Then Newton smirks and says, \"I\'m not Newton, I\'m Pascal\".
athropos ist offline   Mit Zitat antworten
Antwort


Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)
 

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.

Gehe zu


Alle Zeitangaben in WEZ +2. Es ist jetzt 12:59 Uhr.


Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Forum SEO by Zoints
© 2009 FSL Verlag