Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Deleted a hard-coded TxnRef in TestPOS GetLast and ReprintReceipt command * Fixed bug in MessageParser that padded the TxnRef rather than leaving it blank, so the EFTClient didn't like it
- Loading branch information
Sam Coianiz
committed
Oct 8, 2018
1 parent
74b2b4d
commit 9b58bb6
Showing
6 changed files
with
74 additions
and
48 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 |
---|---|---|
@@ -1,41 +1,53 @@ | ||
using System; | ||
|
||
namespace PCEFTPOS.EFTClient.IPInterface | ||
namespace PCEFTPOS.EFTClient.IPInterface | ||
{ | ||
public static class StringExtension | ||
{ | ||
/// <summary> | ||
/// Pad or cut a string so that the length is equal to totalWidth | ||
/// </summary> | ||
/// <param name="v"></param> | ||
/// <param name="totalWidth">The width of the string to return</param> | ||
/// <returns>A string of length totalWidth</returns> | ||
public static string PadRightAndCut(this string v, int totalWidth) | ||
{ | ||
if (v.Length == totalWidth) | ||
return v; | ||
else if (v.Length < totalWidth) | ||
return v.PadRight(totalWidth); | ||
else | ||
return v.Substring(0, totalWidth); | ||
} | ||
public static class StringExtension | ||
{ | ||
/// <summary> | ||
/// Pad or cut a string so that the length is equal to totalWidth | ||
/// </summary> | ||
/// <param name="v"></param> | ||
/// <param name="totalWidth">The width of the string to return</param> | ||
/// <returns>A string of length totalWidth</returns> | ||
public static string PadRightAndCut(this string v, int totalWidth) | ||
{ | ||
if (v.Length == totalWidth) | ||
return v; | ||
else if (v.Length < totalWidth) | ||
return v.PadRight(totalWidth); | ||
else | ||
return v.Substring(0, totalWidth); | ||
} | ||
|
||
/// <summary> | ||
/// Pad or cut a string so that the length is equal to totalWidth | ||
/// </summary> | ||
/// <param name="v"></param> | ||
/// <param name="totalWidth">The width of the string to return</param> | ||
/// <param name="paddingChar">The char to use for padding if required</param>/// | ||
/// <returns>A string of length totalWidth</returns> | ||
/// <summary> | ||
public static string PadRightAndCut(this string v, int totalWidth, char paddingChar) | ||
{ | ||
if (v.Length == totalWidth) | ||
return v; | ||
else if (v.Length < totalWidth) | ||
return v.PadRight(totalWidth, paddingChar); | ||
else | ||
return v.Substring(0, totalWidth); | ||
} | ||
|
||
/// <summary> | ||
/// Pad or cut a string so that the length is equal to totalWidth | ||
/// </summary> | ||
/// <param name="v"></param> | ||
/// <param name="totalWidth">The width of the string to return</param> | ||
/// <param name="paddingChar">The char to use for padding if required</param>/// | ||
/// <returns>A string of length totalWidth</returns> | ||
/// <summary> | ||
public static string PadRightAndCut(this string v, int totalWidth, char paddingChar) | ||
{ | ||
if (v.Length == totalWidth) | ||
return v; | ||
else if (v.Length < totalWidth) | ||
return v.PadRight(totalWidth, paddingChar); | ||
else | ||
return v.Substring(0, totalWidth); | ||
} | ||
} | ||
/// <summary> | ||
/// Returns a substring of totalWidth length, or if input length is less than, leaves it alone | ||
/// </summary> | ||
/// <param name="v"></param> | ||
/// <param name="totalWidth"></param> | ||
/// <returns></returns> | ||
public static string CutAndLeave(this string v, int totalWidth) | ||
{ | ||
if (v.Length > totalWidth) | ||
return v.Substring(0, totalWidth); | ||
else | ||
return v; | ||
} | ||
} | ||
} |
This file contains 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 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