Skip to content

Commit

Permalink
Merge pull request beeware#1 from shyamsunder007/shyamsunder007-patch-1
Browse files Browse the repository at this point in the history
upadte str.java
  • Loading branch information
shyamsunder007 authored Mar 17, 2017
2 parents 090c393 + 757642f commit 88e5a9b
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions python/common/org/python/types/Str.java
Original file line number Diff line number Diff line change
Expand Up @@ -715,25 +715,18 @@ public org.python.Object isalnum() {
}

@org.python.Method(
__doc__ = ""
__doc__ = "S.isalpha() -> bool\n\n returns false when the string has atleast ONE non letter or if it is empty."
)
public org.python.Object isalpha() {
int c = 0;
java.lang.String checkString = this.value;
char currentCharacter;

if (checkString.length() == 0) {
return new org.python.types.Bool(false);
} else {
while (c < (checkString.length())) {
currentCharacter = checkString.charAt(c);
if (!Character.isLetter(currentCharacter)) {
if (!this.value.isEmpty()) {
for (char ch : this.value.toCharArray()) {
if (!(Character.isLetter(ch))) {
return new org.python.types.Bool(false);
}
c++;
}
return new org.python.types.Bool(true);
}
return new org.python.types.Bool(true);
return new org.python.types.Bool(false);
}

@org.python.Method(
Expand Down

0 comments on commit 88e5a9b

Please sign in to comment.