Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
add shiftString
Browse files Browse the repository at this point in the history
xtk to 1.0.7
  • Loading branch information
xiaowine committed Aug 13, 2023
1 parent 42cc60d commit f2e22d8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion xkt/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ afterEvaluate {
create<MavenPublication>("release") {
groupId = "com.github.xiaowine"
artifactId = "XKT"
version = "1.0.6"
version = "1.0.7"
from(components["release"])
}
}
Expand Down
18 changes: 18 additions & 0 deletions xkt/src/main/java/cn/xiaowine/xkt/Tool.kt
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,24 @@ object Tool {
}


/**
* Shift string
*
* @param content
* @param amount
* @return
*/
fun shiftString(content: String, amount: Int): String {
val shiftedChars = CharArray(content.length)
for (i in content.indices) {
val originalChar = content[i]
val shiftedChar = (originalChar.toInt() + amount).toChar()
shiftedChars[i] = shiftedChar
}
return String(shiftedChars)
}


/**
* Is not null
*
Expand Down

0 comments on commit f2e22d8

Please sign in to comment.