-
Notifications
You must be signed in to change notification settings - Fork 478
feat: add a parameter named autoStrip #567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 10 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
fd7ee28
feat: add strip and isBlankChar methods for whitespace handling
delei e302895
feat: add auto strip feature for sheet name and content
delei 1a641b8
feat: add parameter utility class for autoTrim and autoStrip
delei ed6993c
fix: improve StringUtils.strip() and isBlankChar() methods
delei 7306358
refactor: optimize sheet name comparison logic
delei dd03074
feat: add autoStrip parameter and improve related functionalities
delei 67fd0a5
test: add unit tests for StringUtils
delei dd5d371
test: add unit tests for auto strip parameters
delei 2f6902f
refactor: reorganize imports in AutoStripParameterTest
delei 424bc59
Merge branch 'main' into improve-421
alaahong 2c01f14
test: update string utils test for zero width joiner character
delei 501af77
refactor: reorganize the comment
delei cad7322
refactor: update method comments for isBlankChar
delei 43e7e8e
Merge branch 'main' into improve-421
psxjoy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
fastexcel/src/main/java/cn/idev/excel/util/ParameterUtil.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| package cn.idev.excel.util; | ||
|
|
||
| import cn.idev.excel.context.AnalysisContext; | ||
| import cn.idev.excel.context.WriteContext; | ||
| import cn.idev.excel.read.metadata.ReadSheet; | ||
| import cn.idev.excel.write.metadata.WriteSheet; | ||
|
|
||
| /** | ||
| * Parameter Util | ||
| */ | ||
| public class ParameterUtil { | ||
|
|
||
| /** | ||
| * Get autoTrim flag for read | ||
| * | ||
| * @param readSheet actual read sheet | ||
| * @param context Analysis Context | ||
| * @return autoTrim flag | ||
| */ | ||
| public static boolean getAutoTrimFlag(ReadSheet readSheet, AnalysisContext context) { | ||
| return (readSheet.getAutoTrim() != null && readSheet.getAutoTrim()) | ||
| || (readSheet.getAutoTrim() == null | ||
| && context.readWorkbookHolder().getGlobalConfiguration().getAutoTrim()); | ||
| } | ||
|
|
||
| /** | ||
| * Get autoStrip flag for read | ||
| * | ||
| * @param readSheet actual read sheet | ||
| * @param context Analysis Context | ||
| * @return autoStrip flag | ||
| */ | ||
| public static boolean getAutoStripFlag(ReadSheet readSheet, AnalysisContext context) { | ||
| return (readSheet.getAutoStrip() != null && readSheet.getAutoStrip()) | ||
| || context.readWorkbookHolder().getGlobalConfiguration().getAutoStrip(); | ||
| } | ||
|
|
||
| /** | ||
| * Get autoTrim flag for write | ||
| * | ||
| * @param writeSheet actual write sheet | ||
| * @param context Write Context | ||
| * @return autoTrim flag | ||
| */ | ||
| public static boolean getAutoTrimFlag(WriteSheet writeSheet, WriteContext context) { | ||
| return (writeSheet.getAutoTrim() != null && writeSheet.getAutoTrim()) | ||
| || (writeSheet.getAutoTrim() == null | ||
| && context.writeWorkbookHolder() | ||
| .getGlobalConfiguration() | ||
| .getAutoTrim()); | ||
| } | ||
|
|
||
| /** | ||
| * Get autoStrip flag for write | ||
| * | ||
| * @param writeSheet actual write sheet | ||
| * @param context Write Context | ||
| * @return autoStrip flag | ||
| */ | ||
| public static boolean getAutoStripFlag(WriteSheet writeSheet, WriteContext context) { | ||
| return (writeSheet.getAutoStrip() != null && writeSheet.getAutoStrip()) | ||
| || context.writeWorkbookHolder().getGlobalConfiguration().getAutoStrip(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.