JavaScript Translating a piece of js to asp.net (regex involved)

I'm moving a piece of our programming code from client side to server side because of performance issues (note: not all code is in the post, just the part i'm having trouble with)

the specific piece i'm having trouble with is a piece of alias rewriting. Can somebody help me translating this part.

    //1. Force UperCamelCase: "Een lange financiele 443 naam" -> "Een Lange Financiele 443 Naam"
    var strTempAlias = this.strName.replace(/\b[a-z]/g, function (match) { return match.toUpperCase() });

    //2. Only allow a-zA-Z chars. "Een Lange Financiele 443 Naam" -> "EenLangeFinancieleNaam"
    strTempAlias = strTempAlias.replace(/[^a-zA-Z]/g, '');

    //3. Until max length 25: progressive remove small characters: "EenLangeFinaNaam"
    var intShrinkSize = 10
    while (strTempAlias.length > 25 && intShrinkSize > 3) {
        var r = new RegExp("([A-Z]+[a-z]{0," + intShrinkSize + "})([a-z]+)", "g")
        strTempAlias = strTempAlias.replace(r, function (match, $1, $2) { return $1 });
        intShrinkSize -= 2;
    }

I've been able to convert steps 1 and 2 to .net code, but i can't figure out how to convert step 3.

Below you can find the converted versions in vb.net and c# (for me it doesn't matter which version is answered i can program both)

VB.NET

        '1. Force UperCamelCase: "Een lange financiele 443 naam" -> "Een Lange Financiele 443 Naam"
        Dim strTempAlias As String = StrConv(strAlias, VbStrConv.ProperCase)

        '2. Only allow a-zA-Z chars. "Een Lange Financiele 443 Naam" -> "EenLangeFinancieleNaam"
        strTempAlias = Regex.Replace(strTempAlias, "[^A-Za-z0-9]+", "")

        '3. Until max length 25: progressive remove small characters: "EenLangeFinaNaam"
        Dim shrinksize = 10
        While strTempAlias.Length > 25 AndAlso shrinksize > 3
            'last piece of code to translate
        End While

C#

//1. Force UperCamelCase: "Een lange financiele 443 naam" -> "Een Lange Financiele 443 Naam"
string strTempAlias = Strings.StrConv(strAlias, VbStrConv.ProperCase);

//2. Only allow a-zA-Z chars. "Een Lange Financiele 443 Naam" -> "EenLangeFinancieleNaam"
strTempAlias = Regex.Replace(strTempAlias, "[^A-Za-z0-9]+", "");

//3. Until max length 25: progressive remove small characters: "EenLangeFinaNaam"
dynamic shrinksize = 10;
while (strTempAlias.Length > 25 && shrinksize > 3) {
    //last piece of code to translate
}

}

Answer:1

I find the functionality of Array.prototype.join very useful because it only applies the join value to the "inner" connections of the elements in the array. Like so: ['Hey', 'there'].join('-') // Hey-...

I find the functionality of Array.prototype.join very useful because it only applies the join value to the "inner" connections of the elements in the array. Like so: ['Hey', 'there'].join('-') // Hey-...

  1. flatmap works

I am using Bootstrap tabs to load a widget from a server. What I need is to load the tab content as soon as the user click the tab instead of the initial load of the page. For ex below is the HTML for ...

I am using Bootstrap tabs to load a widget from a server. What I need is to load the tab content as soon as the user click the tab instead of the initial load of the page. For ex below is the HTML for ...

  1. bootstrap load content
  2. bootstrap load content on scroll
  3. bootstrap load content on tab click
  4. bootstrap load content on click
  5. bootstrap load content in modal
  6. bootstrap load div
  7. bootstrap load tab content ajax
  8. bootstrap load more content
  9. bootstrap load dynamic content
  10. bootstrap load content into div
  11. load a bootstrap popover content with ajax

Why I am getting the result of -'54'+30 expresion as -24 however when I tried to remove the (minus)- from expression then It is just concatenation of string and gives 5430 as output.Can anyone explain ...

Why I am getting the result of -'54'+30 expresion as -24 however when I tried to remove the (minus)- from expression then It is just concatenation of string and gives 5430 as output.Can anyone explain ...

  1. javascript result object
  2. javascriptresult function
  3. javascript result in mvc
  4. javascript result type
  5. javascript result nan
  6. javascript result keyword
  7. javascript result in html
  8. javascript result
  9. javascript result.push
  10. javascript result undefined
  11. javascript result of assignment
  12. javascript result in asp.net mvc
  13. javascript result of promise
  14. javascript result array
  15. javascript result is not defined
  16. javascript result c#
  17. javascript result disappears
  18. javascript result variable
  19. javascript result to json
  20. javascript result.length

i would like to know about, what does mean by module wrapper function and what does it do to my code ? (function (exports, require, module, __filename, __dirname) { });

i would like to know about, what does mean by module wrapper function and what does it do to my code ? (function (exports, require, module, __filename, __dirname) { });

  1. what does mean in math
  2. what does mean mean
  3. what does mean in text
  4. what does mean in python
  5. what does mean in excel
  6. what does mean in java
  7. what does mean in measuring
  8. what does mean in c++
  9. what does mean in r
  10. what does mean in spanish
  11. what does mean on snapchat
  12. what does mean in javascript
  13. what does mean in sql
  14. what does mean in geometry
  15. what does mean in statistics
  16. what does mean in coding
  17. what does mean national emergency
  18. what does mean absolute deviation mean
  19. what does mean in matlab
  20. what does mean in linux