We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have chemical name C2H5OH which comes in {{value.value}} where value = C2H5OH,
{{value.value}}
I used the function to replace the 2 and 5 with 2 and 5 with code {{value.key == 'mol_formula' ? convertChemical(value.value) : value.value}}
{{value.key == 'mol_formula' ? convertChemical(value.value) : value.value}}
The function is- $scope.convertChemical = function (chemicalName) { var newString = ''; for (i = 0; i < chemicalName.length; i++) { if (chemicalName[i].match(/[\d\.]+/g) != null) { newString += "<sub>" + chemicalName[i] + "</sub>"; } else { newString += chemicalName[i]; } } return newString; }
$scope.convertChemical = function (chemicalName) { var newString = ''; for (i = 0; i < chemicalName.length; i++) { if (chemicalName[i].match(/[\d\.]+/g) != null) { newString += "<sub>" + chemicalName[i] + "</sub>"; } else { newString += chemicalName[i]; } } return newString; }
In output I got the value like
C<sub>2</sub>H<sub>5</sub>OH
but I need it in Chemical format. Like: C2H5OH
Please help
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I have chemical name C2H5OH which comes in
{{value.value}}
where value = C2H5OH,
I used the function to replace the 2 and 5 with 2 and 5 with code
{{value.key == 'mol_formula' ? convertChemical(value.value) : value.value}}
The function is-
$scope.convertChemical = function (chemicalName) { var newString = ''; for (i = 0; i < chemicalName.length; i++) { if (chemicalName[i].match(/[\d\.]+/g) != null) { newString += "<sub>" + chemicalName[i] + "</sub>"; } else { newString += chemicalName[i]; } } return newString; }
In output I got the value like
C<sub>2</sub>H<sub>5</sub>OH
but I need it in Chemical format.
Like: C2H5OH
Please help
The text was updated successfully, but these errors were encountered: